jquery ajax

 1 $.ajax({
 2     type: 'post',
 3     url: "/xxx/yyy?id=1",
 4     data: {
 5         start: start,
 6         end: end
 7     },
 8     dataType: "JSON",
 9     success: function (data) {
10         var brand = $("input[name='brand']:checked").val();
11         if (data.stat == '1') {
12             console.log(11);
13             $("#brand_select_2").prop("checked", true);
14             $("#bsearch").hide();
15             jAlert("tips...");
16         } else {
17             if (brand == 'yes') {
18                 $("#trtop").show();
19                 $("#bdelete").show();
20                 if (data.binfo == '') {
21                     $("#top20").html("no data");
22                 } else {
23                     $("#top20").html(data.info);
24                 }
25                 $('#ids').val(data.ids);
26             }
27         }
28     },
29     error: function(xhr) {
30        var errMsg = "error <br/>" + xhr.status + "(" + xhr.statusText + ")";
31        alert(errMsg);
32     }
33 })

 

posted on 2021-11-11 18:19  coding-farmer  阅读(22)  评论(0编辑  收藏  举报

导航