PDA

View Full Version : Handler submit issue.



Valentyn
12 Dec 2014, 1:03 AM
buttons: [{
text: '?????????', cls: "extjsbttng", minWidth : 95,
handler: function(btn, eventObj) {

var inn_exist = false, num_exist = false;
var tab_num = Ext.getCmp('tab_num').getValue();
Ext.Ajax.request({
url: 'inc/ajax/staff_edit.php?v=tab',
method: 'POST',
params: {
id: tab_num
},
success: function(response, opts) {
var obj = Ext.decode(response.responseText);
console.log(obj);
if (obj.result == 'num_exist')
{
num_exist = true;
Ext.MessageBox.alert('????????','? ????? ????????? ??????? ?????????? ????????? "??? ??????????"');
}
}
});
....
});


Trying to do a test with submit form, refer AJAX request. When this does not work. PHP script staff_edit.php sends a JSON :

{"Lastname":"\u041c\u0430\u0440\u0442\u0456\u043d\u043a\u043e\u0432\u0430","Name":"\u0410\u043b\u0456\u043d\u0430","Middlename":"\u041e\u043b\u0435\u043a\u0441\u0430\u043d\u0434\u0440\u0456\u0432\u043d\u0430","status":"num_exist","success":"ok"}.
Firebug issues: Failed to load response data.
This code works elsewhere. Just add a button - does not work. I can not understand why.
Use ExtJS 4.0.7

Valentyn
12 Dec 2014, 2:35 AM
Problem solved. This happens because after you submit the form occurs reload the page.

Gary Schlosberg
12 Dec 2014, 2:58 PM
Glad it's working for you, and thanks for posting a follow-up.