Topic: xajax URL problem with Chrome

Chrome is giving me the following error:

Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?
URL: HTTP://www.ats.amherst.edu/xajax_0.5//xajax_js/xajax_core.js

When I look at the generated javascript I see,

<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "https://www.ats.amherst.edu/tokyo/tokyo.php";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5 Beta 4";
xajax.config.legacy = false;
x<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "https://www.ats.amherst.edu/tokyo/tokyo.php";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5 Beta 4";
xajax.config.legacy = false;
xajax.config.defaultMode = "asynchronous";
xajax.config.defaultMethod = "POST";
/* ]]> */
</script>
<script type="text/javascript" src="HTTP://www.ats.amherst.edu/xajax_0.5//xajax_js/xajax_core.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8">

The problem is that I don't see where the extra slash is coming from.  The same code works for Firefox and Safari so I'm assuming that they're just more tolerant but is there anyway to solve this problem with Chrome?

Re: xajax URL problem with Chrome

Hi,

Haven't seen this before.

Will look into it...

Ed

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

Re: xajax URL problem with Chrome

I wrote this and it loads properly but my alert is not displayed:

<?php
include_once("xajax/xajax_core/xajax.inc.php");
$xajax = new xajax();
$xajax->configure('javascript URI','http://www.ats.amherst.edu/xajax_0.5/');

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(); ?>
</head>
<body>
<input type="button" value="Click Me" onclick="xajax_test()"/>
</body>
</html>

I get the same page source in the browser in FF and Chrome...

I've not seen the javascript URI declared that way. Usually it's just the xajax folder relative to your php page.

i.e. $xajax->configure('javascriptURI','xajax/'); //Assumes xajax folder on the same level...

Here's the page view in Chrome:

<html>
<head>

<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
try { if (undefined == xajax.config) xajax.config = {}; } catch (e) { xajax = {}; xajax.config = {}; };
xajax.config.requestURI = "http://localhost/Truck%20Loader/amherst.php";
xajax.config.statusMessages = false;
xajax.config.waitCursor = true;
xajax.config.version = "xajax 0.5";
xajax.config.legacy = false;
xajax.config.defaultMode = "asynchronous";
xajax.config.defaultMethod = "POST";
/* ]]> */
</script>
<script type="text/javascript" src="http://www.ats.amherst.edu/xajax_0.5/xajax_js/xajax_core.js" charset="UTF-8"></script>
<script type="text/javascript" charset="UTF-8">
/* <![CDATA[ */
window.setTimeout(
 function() {
  var scriptExists = false;
  try { if (xajax.isLoaded) scriptExists = true; }
  catch (e) {}
  if (!scriptExists) {
   alert("Error: the xajax Javascript component could not be included. Perhaps the URL is incorrect?\nURL: http://www.ats.amherst.edu/xajax_0.5/xajax_js/xajax_core.js");
  }
 }, 2000);
/* ]]> */
</script>

<script type='text/javascript' charset='UTF-8'>
/* <![CDATA[ */
xajax_test = function() { return xajax.request( { xjxfun: 'test' }, { parameters: arguments } ); };
/* ]]> */
</script>
</head>
<body>
<input type="button" value="Click Me" onclick="xajax_test()"/>
</body>
</html>

Note no double slash in the javascript uri.

The javascript looks ok using firebug in both FF and Chrome.

Using my local xajax folder path it works ok.

Also noticed you are using an old beta o v0.5. Perhaps you should try the final version...

Hope this helps you out.

Ed

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