Could somebody please advise how to call post method on load?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<script type="text/javascript" src="jquery-1.5.1.min.js"></script>
<script type="text/javascript" src="jquery.getParams.js"></script>
<script type="text/javascript">
$(document).ready(function(){
var param1 = $.getURLParam("userID");
var param2 = $.getURLParam("password");
alert(param1);
$.post("xlogin.php", { eid: param1 , pw:param2 });
});
</script>
</head>
<body>
</body>
</html>
I want to call this post operation on load of the above PHP code . But some thing is missing ..
You’re not passing any callback to
$.post, so even thoughxlogin.phpis getting a POST request, you’re not doing anything with the result.To do something after the post request, you need do something like this (just an example):
This example assumes
xlogin.phpreturns a JSON document with asuccessfield.