How to use Ajax with jQuery

前端 未结 3 1568
Happy的楠姐
Happy的楠姐 2021-01-03 18:53
function ajaxFunction(){

    var ajaxRequest;  // The variable that makes Ajax possible!

try{
        // Opera 8.0+, Firefox, Safari
        ajaxRequest = new XMLH         


        
3条回答
  •  栀梦
    栀梦 (楼主)
    2021-01-03 19:39

    With jquery you don't have to have this headache.

    just use $.ajax function http://api.jquery.com/jQuery.ajax/ and don't have to bother about browser compatibility or ...

    a simple example is here

    $.ajax({
        url: 'someserverfile.php?someparam_or_nothing', //url
        type: 'get', //method type post or get
        dataType: 'json', //return data type            
        success: function(data) { 
                //on success function handler
    
            },
    });
    

提交回复
热议问题