Topic: Cannot call xajax function after jquery overlay call.....please help!

Hi Guys,

I'm currently building an xajax based eCommerce store but having issues with xajax functions after calling jQuery tools overlay.

The following script loads a shopping_basket.php page into a contentWrap. Once this window is closed any xajax function cannot be called. There is nothing in the error logs on the server.

I'm new to jQuery so I could be doing something real stupid.

$(document).ready(function() {
      $("a[rel]").overlay({
        mask: {
          color: '#fff',
          loadSpeed: 200,
          opacity: 0.5
        },
        closeOnClick: true,
        onBeforeLoad: function() {
          var wrap = this.getOverlay().find(".contentWrap");
          wrap.load(this.getTrigger().attr("href"));
        }
      });
    });


Thanks in advance.

Paul

Re: Cannot call xajax function after jquery overlay call.....please help!

Paul,

Welcome to the forum.

I have been playing with this some and cannot get things to work. Could you possibly post the offending php and html?

Thanks,
Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Cannot call xajax function after jquery overlay call.....please help!

I messed some more and this code works fine:

<?php
include_once("xajax/xajax_core/xajax.inc.php");
$xajax = new xajax();
$xajax->configure('javascript URI', 'xajax/');

function test()
{
  $resp = new xajaxResponse();
  $resp->alert('It Works...');
  return $resp;
}

$xajax->register(XAJAX_FUNCTION,'test');
$xajax->processRequest();
?>
<!DOCTYPE html>
<html>
<head>
<?php $xajax->printJavascript(); ?>
<script src="http://cdn.jquerytools.org/1.2.7/full/jquery.tools.min.js"></script>
<script type="text/javascript">
$(document).ready(function() {
      $("a[rel]").overlay({
        mask: {
          color: '#fff',
          loadSpeed: 200,
          opacity: 0.5
        },
        closeOnClick: true,
        onBeforeLoad: function() {
          var wrap = this.getOverlay().find(".contentWrap");
          wrap.load(this.getTrigger().attr("href"));
        }
      });
    });
</script>
</head>
<body>
<a href="upload.html" rel="#ovr" href="#">Overlay</a><br/>
<input type="button" value="Click" onclick="xajax_test()" /><br/>
<div id="ovr">
<div class="contentWrap"></div>
</div>
</body>
</html>

Not sure it does just what you want though...

Edit: Changed the body content to load an html page in my workspace. Xajax works before and after overlay.
Ed

If you ever stop learning you may as well dig a hole, crawl in and pull the top over yourself.

Re: Cannot call xajax function after jquery overlay call.....please help!

Hi Ed,

Thanks for the time taken to look into this. I'm gonna to go through and compare with my code......

Will let you know :-)

Cheers.

Re: Cannot call xajax function after jquery overlay call.....please help!

I dont know what's different from my own but this code works for me. Thanks so much. Still not exactly sure what I was doing wrong but very happy its working ok.

Thanks again.