lisovaccaro
lisovaccaro

Reputation: 33956

AJAX pass 2 variables to .php file

I need to pass the variables uid and siteAurl with AJAX. How do I do it?

You can see me doing it wrong here:

xmlhttp.open("GET","insert/insert-badge.php?user="uid"&site="+siteAurl,true);

Thanks

Upvotes: 0

Views: 373

Answers (1)

Jiri Kriz
Jiri Kriz

Reputation: 9292

xmlhttp.open("GET","insert/insert-badge.php?user=" + uid + "&site=" + siteAurl, true); 

The variables uid and siteAurl should be encoded with encodeURIComponent() before they are used in the above URL.

Upvotes: 1

Related Questions