Home > Web Front-end > JS Tutorial > Detailed introduction to adding ajax get function to artDialog 5.02_jquery

Detailed introduction to adding ajax get function to artDialog 5.02_jquery

WBOY
Release: 2016-05-16 17:48:17
Original
1237 people have browsed it

I have used versions before artDialog 5.0 before, and I really admire the author's creativity and professionalism. Now the functions of the new version are developing towards the convenience of lightweight js. I still prefer the functions of artDialog.open before, which are direct and convenient. But the previous version was a bit big. Now I just want to add some remote content from ajax to artDialog. My code is as follows:

Copy code The code is as follows:

$.extend({
_htmlDataArr:new Array(),
_findHTML:function(url){
var hd_len= $._htmlDataArr.length ;
for(var i=0;i{
if($._htmlDataArr[i][0]==url){
return $._htmlDataArr[i] [1];
}
}
return null;
},
extDialog:function(url,options){
var options=$.extend({okValue:'OK ',cancelValue:'Cancel',lock:true,title:'Dialog'}, options);
//If it exists, the url will not be accessed
var _get_html= $._findHTML(url);
if(_get_html!=null){
options.content=_get_html;
artDialog(options);
}else{
$.get(url,function(html){
_new_get_arr = new Array();
_new_get_arr[0]=url;
_new_get_arr[1]=html;
$._htmlDataArr.push(_new_get_arr);
options.content=html;
artDialog(options);
});
}
}
});

Call method
Copy code The code is as follows:

$.extDialog('url','{parameters in artDialog, content does not need to be written}'};
Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template