jasmine825 jasmine825 - 4 months ago 8
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.


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 );