KindEditor/Ajax API:修订间差异
来自站长百科
(以内容“{{KindEditor导航}} *'''K.loadScript(url [, fn])''' 加载JavaScript文件。 参数: #string url: JavaScript URL #function fn: 回调函数 返回: undefined 示...”创建新页面) |
无编辑摘要 |
||
第2行: | 第2行: | ||
*'''K.loadScript(url [, fn])''' | *'''K.loadScript(url [, fn])''' | ||
加载[[JavaScript]]文件。 | |||
参数: | 参数: | ||
第18行: | 第18行: | ||
*'''K.loadStyle(url)''' | *'''K.loadStyle(url)''' | ||
加载[[CSS]]文件。 | |||
参数: | 参数: | ||
第35行: | 第35行: | ||
参数: | 参数: | ||
#string url: JavaScript URL | #string url: JavaScript [[URL]] | ||
#function fn: 回调函数 | #function fn: 回调函数 | ||
#string method: “GET”或”POST”,默认值为”GET” | #string method: “GET”或”POST”,默认值为”GET” |
2011年12月28日 (三) 09:17的最新版本
- K.loadScript(url [, fn])
加载JavaScript文件。
参数:
- string url: JavaScript URL
- function fn: 回调函数
返回: undefined
示例:
K.loadScript('test.js', function() { console.log('ok'); });
- K.loadStyle(url)
加载CSS文件。
参数:
string url: CSS URL
返回: undefined
示例:
K.loadScript('test.css');
- K.ajax(url [, fn , method , data])
GET或POST请求。
参数:
- string url: JavaScript URL
- function fn: 回调函数
- string method: “GET”或”POST”,默认值为”GET”
- object data: POST数据,key-value格式
返回: undefined
示例:
//GET K.ajax('test.php', function(data) { console.log(data); }); //POST K.ajax('test.php', function(data) { console.log(data); }, 'POST', { aa : 1, bb : 2 });
参考来源[ ]
KindEditor使用手册导航 | ||||||
---|---|---|---|---|---|---|
|