How to update a specific div with ajax and jquery

前端 未结 2 511
夕颜
夕颜 2021-01-23 15:02

I\'m working on site and it has a fram. think of the gmail frame. And much like the gmail app I want only the inner div to be updated when clicking links on the navbar. I\'ve go

2条回答
  •  执念已碎
    2021-01-23 15:16

    Here's the Jquery ajax link http://api.jquery.com/jQuery.ajax/

    Eg Code :

    ajax_control = jQuery.ajax({
        url: "target.php",
        type: "POST",
        data: {variable_name: variable_value}
    });
    ajax_control.always(function(){
        $('#content').html(ajax_control.responseText);
    });
    

    By assigning the call to a variable ("ajax_control" in the above example), you can abort whenever you want, by using :

    ajax_control.abort();
    

    http://api.jquery.com/jQuery.post/ http://api.jquery.com/jQuery.get/

提交回复
热议问题