I have a function with two Ajax Get call. after success two Ajax have different function for success handling
function get_power_mgt_settings() {
window.mv.do_ajax_call('GET',power_mgt.get_spin_down_url{},'xml',true,show_spin_down_settings, window.mv.handle_error);
window.mv.do_ajax_call('GET',power_mgt.get_power_schedule_url{},'xml',true,show_power_schedule_settings, window.mv.handle_error);
}
function show_power_schedule_settings(data) {
----some data to populate table<br>
}
function show_spin_down_settings(data){
-----some data to populate table<br>
}
My problem is that , i have 2 submit button when i click submit button it call a function for saving data. In first submit button after submitting data i need to reload show_power_schedule_settings() only. In second submit button after submitting data i need to call show_spin_down_settings()
only. But actually this two function is merged with single function named get_power_mgt_settings()
. So my doubt is how can i call only one function from this. Thanks in advance.
give parameter in get_power_mgt_settings(params);
example:
function get_power_mgt_settings(type) {
if(type="firstSubmit"){
window.mv.do_ajax_call('GET',power_mgt.get_spin_down_url{},'xml',true,show_spin_down_settings, window.mv.handle_error);
}else if(type="secondSubmit"){
window.mv.do_ajax_call('GET',power_mgt.get_power_schedule_url{},'xml',true,show_power_schedule_settings, window.mv.handle_error);
}else{
alert("whatever what doyou want");
}
}
and call with get_power_mgt_settings("secondSubmit");
that is just execution window.mv.do_ajax_call('GET',power_mgt.get_power_schedule_url{},'xml',true,show_power_schedule_settings, window.mv.handle_error);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.