-
April 25th, 2007, 06:10 AM
#1
POST two or more variables using AJAX
hi gurus.
how can we send two or more values of variables using AJAX to PHP script
my code is:-
<script type="text/javascript">
function ajaxFunction()
{ var xmlHttp;
try
{ // Firefox, Opera 8.0+, Safari
xmlHttp=new XMLHttpRequest();
}
catch (e)
{ // Internet Explorer
try
{ xmlHttp=new ActiveXObject("Msxml2.XMLHTTP"); }
catch (e)
{ try
{ xmlHttp=new ActiveXObject("Microsoft.XMLHTTP"); }
catch (e)
{ alert("Your browser does not support AJAX!"); return false; } } }
xmlHttp.onreadystatechange=function()
{
if(xmlHttp.readyState==4)
{
document.myForm.mess.value=xmlHttp.responseText;
}
}
var url="varify.php";
// var params = document.myForm.
var nam = document.getElementById('name').value;
var pas = document.getElementById('pass').value;
// alert(pass.value);
// alert(name.value);
params="name="+nam+"pass="+pas;//cancatenation
// var pass = document.myForm.pass.value;
xmlHttp.open("POST",url,true);
xmlHttp.setRequestHeader("Content-type", "application/x-www-form-urlencoded");
xmlHttp.setRequestHeader("Content-length", params.length);
xmlHttp.setRequestHeader("Connection", "close");
xmlHttp.send(params); //here i wana send 2 parameters ie name and password
}
</script>
-
April 25th, 2007, 07:22 AM
#2
Re: POST two or more variables using AJAX
hay gurus I got solution code is given below ie
params="name="+nam+"&pas="+pas;//cancatenation
this action ca help us to post
Last edited by kku; April 25th, 2007 at 11:57 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|