Passing multiple variables in URL
If I do something like
var url = "dynamicprice.php";
httpObject.open("GET", url, true);
everythi开发者_开发技巧ng works, but if I try to pass variables
var url = "dynamicprice.php?package=" + document.getElementById('package').value + "&markup=" + document.getElementById('markup').checked;
httpObject.open("GET", url, true);
I get no answer from dynamicprice.
What do I have to change?
If the elements that you're referring to (markup
and package
) don't exist, then url
is never created, and your request will never be sent. Try sticking alert(url);
before httpObject.open(...);
and make sure that you've got the right URL.
Alert the values before constructing the url is your first best bet.Also alert the url after constructing it.
paste the url directly in the browser so that you can see any errors on server side
精彩评论