Forum Moderators: open
Im struggling with yahoo connection manager example . Strangely enough the examples are not that easy to follow .
<html>
<body>
<script src="http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js"</script>
<script src="http://yui.yahooapis.com/2.5.2/build/event/event-min.js"</script>
<script src="http://yui.yahooapis.com/2.5.2/build/connection/connection-min.js"</script>
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js" </script>
<script>
var handleSuccess = function(o){
if(o.responseText !== undefined){
div.innerHTML = "Transaction id: " + o.tId;
div.innerHTML += "HTTP status: " + o.status;
div.innerHTML += "Status code message: " + o.statusText;
div.innerHTML += "<li>HTTP headers: <ul>" + o.getAllResponseHeaders + "</ul></li>";
div.innerHTML += "PHP response: " + o.responseText;
div.innerHTML += "Argument object: " + o.argument;
}
}
var callback =
{
success:handleSuccess,
failure: handleFailure,
argument: ['foo','bar']
};
var sUrl= "post.php";
var postData = "username=anonymous&userid=0";
function makeRequest()
{
var request = YAHOO.util.Connect.asyncRequest('POST', sUrl, callback, postData);
}
</script>
<form><input type="button" value="Send a POST Request" onClick="makeRequest();"></form>
</body>
</html>
and Php
<?
print_r($_POST);
?>
but it does not seem to work ? any suggestions ?
Next, your callback object defines failure as a non-existent method 'handleFailure', so you should create that method first.
Try fixing those and then reporting back with what exactly happens.