$.ajax({
url: '请求地址',
type: 'GET/POST/PUT/DELETE',
dataType: 'json/xml/text',
data: {参数: 值, 参数: 值},
timeout: 3000,
success: function(response) {
// 成功回调
},
error: function(xhr, status, error) {
// 失败回调
}
});

 

  • url‌:请求地址
  • type‌:请求类型(GET/POST/PUT/DELETE)
  • dataType‌:预期响应类型(json/xml/text)
  • data‌:发送到服务器的数据(对象或查询字符串)
  • timeout‌:超时时间(毫秒)
  • success‌:请求成功时执行的函数
  • error‌:请求失败时执行的函数 ‌

 

<script type="text/javascript">
//产品规格自动生成 START 2023年11月14日 00:43:22 LKY 完结
$(function(){
      $('#cpmc').on('input', function () {     
      //$('#weizhianniu').on('click', function () {        
        $.ajax({
          type: 'GET',
          url: 'http://python.lzychina.com:8000/name_get_product_id.html',
          data: {          
          name:$('#cpmc').val(),//获取第一相OPTION里的值   
          },
          success: function (res) {
              
             $("#name_get_select").html(res);
             //alert(res);
             }
        })
      }),
     //alert("继续执行我这句");
        $.ajax({
          type: 'GET',
          url: 'http://python.lzychina.com:8000/auto_get_product_kucun.html',
          data: {          
          pid:$('#cpid').val(), 
          },
          success: function (res) {              
             $("#cpkc").val(res);
             //alert("调用成功");
             },
          error: function (xhr, status, error) {              
             //alert("调用失败");
             $("#cpkc").val("0");             
             },
                       



             
        })
      
    })
//END
</script>
声明:本站所有文章,如无特殊说明或标注,均为本站原创发布。任何个人或组织,在未征得本站同意时,禁止复制、盗用、采集、发布本站内容到任何网站、书籍等各类媒体平台。如若本站内容侵犯了原著者的合法权益,可联系我们进行处理。