JQuery AJAX syntax

前端 未结 9 1873
旧时难觅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 20:59

      $(document).ready(function() {
      $.ajax({
        type: "POST",
        url: "Webservices/EmployeeService.asmx/GetEmployeeOrders",
        data: "{'EmployeeId':'empid'}", **<-- see the single quotes**
        contentType: "application/json; charset=utf-8",
        dataType: "json",
        success: function(msg) {
              alert(msg);
             }
      });
    });
    

提交回复
热议问题