Pass AJAX data

Asked

Viewed 62 times

1

Good afternoon to all...

I need to pass that information on "token", "<?php echo $tokenAnuncio; ?>",

In this capacity:

function load_image_data(){
    $.ajax({
        url:"/fetch.php",
        method:"POST",
        success:function(data)
        {
            $('#image_table').html(data);
        }
    });
}

How to do?

1 answer

3


You can put directly this way:

function load_image_data(){
    $.ajax({
        url:"/fetch.php",
        method:"POST",
        data: { token: "<?php echo $tokenAnuncio; ?>" },
        success:function(data)
        {
            $('#image_table').html(data);
        }
    });
}

And to get this information from your fetch.php page, just use the $_POST global array, for example:

$token = $_POST['token'];
  • 1

    Perfect bro.... mto thx

  • Please evaluate the question and mark it as an answer.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.