-
1 Aug 2008 2:23 AM #1
return value of ajax call
return value of ajax call
Hi All,
I have one function which is used to validate IPv4 address. Let me know what will be the return value of this function.
here as per my understanding if ipv4 address is not valid it will display me message but if it true then what it will do?
What will be the return value of this function?
ThanksCode:My call of this function is like ,saveIp(ipv4){ if(ipv4 != ""){ this.validateIPv4(); } } // save Ip ends here // function for validating IPv4 address ,validateIPv4:function(IPvalue){ Ext.Ajax.request({ url: script_path + 'managedevice/managedevice.php', params: { mode:"checkIpv4", ipv4:IPvalue }, success: function(response){ var o = Ext.decode(response.responseText); alert(o.success); switch(o.success){ case true: // Success return; break; case false: // Fail Ext.MessageBox.alert('Error','Invalid Ipv4 address.'); return; break; } }, failure: function(response){ var result=response.responseText; Ext.MessageBox.alert('error','could not connect to the database. retry later'); } }); } // eof of validateIPv4
Hiral
-
1 Aug 2008 3:15 AM #2
You can't do that. Ajax is asynchronous
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
1 Aug 2008 4:22 AM #3
Hi Animal,
Can you give some idea to do this?
Is there any way that I can check something from server side and return like this way?
Thanks
hiral
-
1 Aug 2008 4:43 AM #4
It is possible to kludge Ajax to return synchronously. But not a good idea. See hendricd's Ajax UX.
Search the forum: http://www.google.com/coop/cse?cx=01...%3Az7of1ufqccu
Read the docs too: http://extjs.com/deploy/dev/docs/
Scope: http://extjs.com/forum/showthread.ph...642#post257642
-
1 Aug 2008 6:38 AM #5
The proper way it to chain events. Its always possible to do this, it just means unlearning a bit of ingrained procedural programming techniques and learning event driven techniques



Reply With Quote