Forum Moderators: open

Message Too Old, No Replies

Yahoo YUI Connection manager

Help needed

         

nicknick

3:50 pm on Sep 17, 2008 (gmt 0)

10+ Year Member



Hi ,

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 += "&lt;li&gt;HTTP headers: &lt;ul&gt;" + o.getAllResponseHeaders + "&lt;/ul&gt;&lt;/li&gt;";
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 ?

Fotiman

4:23 pm on Sep 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



First, get rid of the last include of yahoo-min, as you've already included it as the first item. Remove this line:
<script type="text/javascript" src="http://yui.yahooapis.com/2.5.2/build/yahoo/yahoo-min.js" </script>

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.

Fotiman

4:26 pm on Sep 17, 2008 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Also, did you try my code example from [webmasterworld.com...]
?

nicknick

12:16 pm on Sep 18, 2008 (gmt 0)

10+ Year Member



Yes , thanks I got it working