asp.net jquery ajax 跨域调用

js:
        jQuery(document).ready(function(){
                $.ajax({
                    type : 
"GET",
                    url : 
"http://service.test.com/t1.ashx?callback=?",
                    dataType : 
"jsonp",
                   jsonp: 
"callback",
                    success : 
function(json){
                        $(
'#feeds').html(json.msg);
                        
return true;
                    }
                });
            });

    <div id="feeds">   </div>

t1.ashx
1         public void ProcessRequest(HttpContext context)
2         {
3             context.Response.ContentType = "text/html";
4             string callback = context.Request.Params["callback"];
5             context.Response.Write(callback + "({\"msg\":\"jquery test message!\"})");
6         }
posted on 2009-08-27 12:15  myx  阅读(1845)  评论(1编辑  收藏  举报