Ajax with prototype
25th Jan 2010 at 5:39 AM | Posted in Ajax with jquery & prototype | Leave a commentvar url = 'checkZip.php';
var params = 'zip=' + $F('zip'); //$F('zip')get the value of field zip
var ajax = new Ajax.Updater({success: 'zipResult'},
url,
{method: 'get', parameters: params, onFailure: reportError});
}
}
function reportError(request) {
$F('zipResult') = "Error";
}
The html is below:
<body>
<form>
<label for="zip">zip:</label>
<input type="text" name="zip" id="zip" onkeyup="checkZip();" />
<div id="zipResult"></div>
</form>
</body>
Get help from http://www.petefreitag.com/item/515.cfm
Call ajax using jquery
25th Jan 2010 at 3:33 AM | Posted in Ajax with jquery & prototype | Leave a commentSave some data to the server and notify the user once it’s complete.
Syntaxt is:
$.ajax({
type: "POST",
url: "some.php",//page where tha ajax call is made
data: "name=John&location=Boston", //this data will be sent to some.php page
success: function(msg){
alert( "Data Saved: " + msg );
}
});
(don't forget to include jquery.js file into your script)
Blog at WordPress.com. | Theme: Pool by Borja Fernandez.
Entries and comments feeds.
