hey ,
currently i seem to be having problems with a script im not entirely sure what the problem is , if its the ajax script or maybe php problem, It seems to work using safari , but doesnt with Internet explorer

the code is here

<html>
<head>
<title></title>
<script type="text/javascript" src="HttpClient.js"></script>
<script type="text/javascript">
function handleForm(form) {
	var serverUrl='basic-urlencoded.php';


var client = new HttpClient();
client.isAsync = true;
client.requestType = 'POST';

// urlencode the payload
payload = "ajax=true";
for(var i =0; i < form.elements.length; i++) {
	if (form.elements[i].name) {
		if (payload != "")  {
			payload += "&";
		}
		payload +=  encodeURIComponent(form.elements[i].name)
		+ '=' + encodeURIComponent(form.elements[i].value);
	}
}

client.callback = function(result) {
	document.getElementById('target').innerHTML = result;
};

client.makeRequest(serverUrl,payload,
		'application/x-www-form-urlencoded');
return false;
}

</script>
</head>
<body>
<form method="POST" onsubmit="return handleForm(this)">
	<p><label>Source String:</label> 
	<input name="payload" id="string"></p>

</form>

<div id="target"></div>

<div style="position: absolute; width:100px; height:20px; 
	top: 5px; right: 5px; display:none" 
	id="HttpClientStatus">Loading ...</div>

</body>
</html>

basic-urlencoded.php
is

<?php

$payload = "";
if (isset($_POST)) {
	$payload = $_POST['payload'];

echo "inc inc inc $payload";
}

?>

in safari it will print inc inc inc and the variable result

Internet explorer prints inc inc inc only

anyone can shed light on this ? its my sleep time too
thanks

    This is clearly a client-side problem which exists inside HttpClient.js - please take that up with the author of that package.

    Mark

      thanks , i didnt think about that ,

      will fix 🙂

        fixed , needed to add header to the client script

        this.xmlhttp.setRequestHeader("Content-Type", "application/x-www-form-urlencoded");

          Write a Reply...