jasmine825 jasmine825 - 1 year ago 67
jQuery Question

Another way for calling a get method

Is there another way to get a function from another page, that contains a variable being passed? My code:

function getvoucher(id){

$.get("http://inactive/test.php?id=" + id, function(data, status){
return data;

However, the console tells me that my get method is wrong, is there another way I could do this? I receive what is in the page is just does not display, all I get is a blank page.

Answer Source

better you make your ajax request with .done event

   var url="http://inactive/test.php?id=" + id;
   $.get( url)
      .done(function( data ) {
        alert( "Data Loaded: " + data );
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download