ITeye博客

jquery ajax 跨域调用

wxw850227 · 2009-05-15 20:29 · js · jsonp · Ajax · PHP · json · jQuery · Markdown

js端: $.ajax({ type : "GET", url : "http://*.com/.php?callback=?", dataType : "jsonp", jsonp: 'callback', success : function(json){ alert(json.msg);

        }
    });

服务端: $callback = $_GET['callback']; echo "{$callback}({'msg':'this is a jquery jsonp test message!'})"; exit();

评论(0)

暂无评论。

评论功能维护中,当前仅展示历史评论。