2017-09-11 45 views
-2

我有以下的javascript函數,我想轉換到jQuery呢:轉換js函數到jQuery函數

function confirm() { 

    var http = new XMLHttpRequest(); 
    var url = "index.php?tag=' . $dt . '"; 
    var params = "confirm_ref=' . urlencode(encrypt($br,$k)) . '"; 
    http.open("POST", url, true); 
    http.setRequestHeader("Content-type", "application/x-www-form-urlencoded"); 
    http.onreadystatechange = function() { 
      if(http.readyState == 4 && http.status == 200) { 

      } 
       } 
    http.send(params); 
    } 

關於如何正確設置它的任何指針? 謝謝。

+2

https://api.jquery.com/jquery.post/ – j08691

+1

...我的意思是,剛剛在看的'$ .post'或'$ .ajax'文檔應該足夠了。 –

+0

'$ .post(url,{data:params})。done(function(){...});' –

回答