javascript中ajax和jsonp使用技巧代码详解
来源:动视网
责编:小采
时间:2020-11-27 20:15:53
javascript中ajax和jsonp使用技巧代码详解
javascript中ajax和jsonp使用技巧代码详解:Ajax请求jquery ajax函数封装了一个ajax的函数,代码如下:var Ajax = function(url, type success, error) { $.ajax({ url: url, type: type, dataType: 'json', timeout: 10000, success: func
导读javascript中ajax和jsonp使用技巧代码详解:Ajax请求jquery ajax函数封装了一个ajax的函数,代码如下:var Ajax = function(url, type success, error) { $.ajax({ url: url, type: type, dataType: 'json', timeout: 10000, success: func

Ajax请求
jquery ajax函数
封装了一个ajax的函数,代码如下:
jsonp方式
有时候我们为了跨域,要使用jsonp的方法,也封装了一个函数:
javascript中ajax和jsonp使用技巧代码详解
javascript中ajax和jsonp使用技巧代码详解:Ajax请求jquery ajax函数封装了一个ajax的函数,代码如下:var Ajax = function(url, type success, error) { $.ajax({ url: url, type: type, dataType: 'json', timeout: 10000, success: func