Works:
function jsUpvote(photo_id, username) {
//var getURL = "http://www.uglyfacez.com/gallery/upvote.php?photo_id=" + photo_id + "&username=" + username;
$.get("http://uglyfacez.com/gallery/upvote.php?photo_id=15&username=user000",
function(returnValue){
// do stuff here
});
}
I wrote the function above to run a php script on the page and pass in the variables photo_id and username to the script through the URL. When I hard code it, as above, it works just fine, but when I give it the javascript variables (as you can see in getURL), it won't work at all. For example, this is what I want to do, but will not work:
$.get("http://www.uglyfacez.com/gallery/upvote.php?photo_id=" + photo_id + "&username=" + username,
function(returnValue){
// do stuff here
});
Why will this not work and what is the solution?
EDIT: I discovered what the problem was. For some reason, including www in my GET url keeps it from receiving a response from the server. Once removed from the URL, it works just fine.