zoukankan      html  css  js  c++  java
  • js异步调用的几种方法

    Ext.Ajax.request({  
                    url : urlStr,  
                    params : paramsObj,  
                    method : 'POST',  
                    success : function(response) {  
                        if (callbackFunc) {  
                            var result = Ext.util.JSON  
                                    .decode(response.responseText);  
                            var cbfn = callbackFunc.createCallback(result);  
                            cbfn();  
                        }  
                    },  
                    failure : function() {  
                        Ext.Msg.alert("提示", "方法调用失败");  
                    }  
                });  
     
    Jquery ajax 的 $.ajax(),$.post(),$.get(),$.getJSON();
    $.ajax({

                        type: "post",

                        url: "JqueryCSMethodForm.aspx/GetNowDate",

                        datatype: "json",

                        contentType: "application/json; charset=utf-8",

                        success: function(data) {

                            $("input#showTime").val(eval('(' + data.d + ')')[0].nowtime);

                        },

                        error: function(XMLHttpRequest, textStatus, errorThrown) {

                            alert(errorThrown);

                        }

                    });
    jQuery.post( url [, data] [, success(data, textStatus, jqXHR)] [, dataType] )

    http://api.jquery.com/jQuery.post/
     

    jQuery.get( url [, data] [, success(data, textStatus, jqXHR)] [, dataType] )

    $.get("test.cgi", { name: "John", time: "2pm" },
       function(data){
         alert("Data Loaded: " + data);
       });

    $.getJSON("http://api.flickr.com/services/feeds/photos_public.gne?jsoncallback=?",
      {
        tags: "cat",
        tagmode: "any",
        format: "json"
      },
      function(data) {
        $.each(data.items, function(i,item){
          $("<img/>").attr("src", item.media.m).appendTo("#images");
          if ( i == 3 ) return false;
        });
      });








  • 相关阅读:
    二叉树中序遍历的非递归实现
    求树的遍历、树的叶子节点个数、树的高度、copy树
    javascript知识点汇总(running)
    IOS零碎知识点(积累中)
    Cuda learn record three
    Cuda learn record two
    找出字符串中的最长的回文子串
    Cuda learn record one
    Chrome 安装失败 错误代码 0X80070057
    Vs 2015 项目中include 无法打开源文件
  • 原文地址:https://www.cnblogs.com/guo0/p/2270471.html
Copyright © 2011-2022 走看看