JQuery AJAX syntax

前端 未结 9 1871
旧时难觅i
旧时难觅i 2021-01-17 20:11

I am trying to find the correct syntax to pass a varible to my JQuery Post.

var id = empid;

$.ajax({
    type: \"POST\",
    url: \"../Webservices/EmployeeS         


        
9条回答
  •  执笔经年
    2021-01-17 21:05

    you can use the following.

    var id = empid;
    
    $.ajax({
        type: "POST",
        url: "../Webservices/EmployeeService.asmx/GetEmployeeOrders",
        data: "var1=val1&var2=val2&var3=val3&var4=val4&var5=val5",
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function (result) {
            alert(result.d);
        }
    

提交回复
热议问题