jQuery:如何使用参数和正文进行http请求?

时间:2012-03-31 09:30:32

标签: javascript jquery http

所以我想用一个正文(比如file, file2, file3)和像action=delete之类的参数发一个http请求如何使用jquery发出这样的请求?

2 个答案:

答案 0 :(得分:2)

使用urlfiles与body:

传递参数
$.ajax({
    url: 'someurl' + '?action=delete',
    type: 'POST',
    data: requestbodyhere,
    success: function(responseData){
    }
});

答案 1 :(得分:1)

您想要发帖吗?你可以使用Ajax做到这一点:

jQuery.ajax({
  type: 'POST',
  url: url,
  data: {
    file1:'file1',
    flie2:'file2'
  },
  success: function(response) {
    //in response you have the answer from the server as a string
  }
});
相关问题