$.ajax({ type: "GET", url: "some.php", data: "name=John&location=Boston", success: function(msg){ alert( "Success" ); } });
this isn't a direct translation of your js to jquery but this shows the principle. shapo wrote:
Hi Guys I am having a tough time getting the hang of jQuery so the best of learning for me is to see my current code in jQuery so I can understand it better. Here is an GET ajax request I make in JS: function GET(link) { // -- Enable Loader Tag setClassName("message", "display"); // -- Execute xmlhttprequest var xhr = CreateRequest(); xhr.open("GET",link,false); xhr.send(null); try { // -- Check for Custom Exception Message var x = xhr.responseXML.getElementsByTagName("message"); if(x != null) { //-Print Exception exception(x[0].childNodes[0].nodeValue); return false; } } catch(e) { // -- No custom exception found, continue as normal if(xhr.status==200) { setClassName("message", "setnone"); return xhr.responseText; } else if(xhr.status==500) { exception(500); return false; } else if(xhr.status==501) { exception(501); return false; } else if(xhr.status==404) { exception(404); return false; } } } Is it ok if someone could convert it into a jQuery for me ? I have gone through many tutorials but I wouldnt know how to implement it into my code above.