How do i pass a variable in the xmlhttp.send function
How do i pass a variable in the xmlhttp.send function
var str = "hello"
xmlhttp.open("POST","./omnama.php",true);
xmlhttp.setRequestHeader("Content-type","application/x-www-form-urlencoded");
xmlhttp.send("fname=+str"); ' it fills the database with str but not with hello
I tried these not working
xmlhttp.send("fname=" +str,"lname=" +cool);
it fills the fname with variable value but not lname, lname gives an empt开发者_如何学Cy string how do i combine if i have many variables to pass on ?
xmlhttp.send("fname=" + str); it should work
xmlhttp.send("fname=" +str + "&lname=" +cool);
It is just a string. Treat it like any other string.
foo("some string" + another_string_stored_in_a_variable);
精彩评论