EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: Aod47 on March 01, 2020, 05:36:33 AM



Title: Is possible to load form with method 'post' like a load panel
Post by: Aod47 on March 01, 2020, 05:36:33 AM
eg.

Code:
$('#fm').form({method: 'post', onBeforeLoad: function(param){ param.itemId = itemId}});
$('#fm').form('load', 'getItem.ashx');

Thank you for advice.



Title: Re: Is possible to load form with method 'post' like a load panel
Post by: jarry on March 03, 2020, 07:44:30 PM
Please extend a new special method to load your form data.
Code:
<script type="text/javascript">
$.extend($.fn.form.methods, {
loadRemote: function(jq, param){
return jq.each(function(){
var f = $(this);
$.ajax({
url: param.url,
data: param.params||{},
dataType: 'json',
success: function(data){
f.form('load', data);
}
});
})
}
})
</script>

Usage example:
Code:
$('#fm').form('loadRemote', {url:'getItem.ashx',params:{itemId:'itemId}});


Title: Re: Is possible to load form with method 'post' like a load panel
Post by: Aod47 on March 05, 2020, 06:36:32 PM
Wonderful!!  ;D