Hey all I am trying to create a Prototype Ajax functino that will
return the data out of the fuinction. Here is my code
[code]
function SendData(urlString,url)
{
var opt = {
// Use POST
method: 'post',
// Send this lovely data
//postBody: 'p1=firsttime',
postBody: urlString,
// Handle successful response
onSuccess: function(t) {
// Sending the responcd to be
parsed and entered in the correct
places
alert("From withing the function ** " +
t.responseText + "
**");
return(t.responseText); //
<---- Trying to return data
},
// Handle 404
on404: function(t) {
alert('Error 404: location "' +
t.statusText + '" was not
found.');
},
// Handle other errors
onFailure: function(t) {
alert('Error ' + t.status + ' -- ' +
t.statusText);
}
}
return returnData; // <-------Trying to return
data
new Ajax.Request(url, opt);
}
</script>
<script type="text/javascript">
function doME()
{
var test =
SendData('lala','http://miys02ae211935l/learn/
dhtmlwindow/showme.php');
alert(test);
}
[/code]
in the doMe function I would like to return the var test from the
SendData Function. Not sure why this is not working.
Thanks,
timgerr
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---