Reputation: 262
Code is as below:
Ext.Ajax.request({
url: url,
method: 'POST',
headers: { 'Content-Type': 'application/json' },
jsonData: {
textMatchStyle:"substring",
fields: ["packageName","name","tableName"],
data: {_domain:null,_domainContext:{},operator:"and",criteria:[]},
limit: 40,
offset: 0
},
success: function(response) {
console.log('Success');
},// function called on success
failure: function(result) {Ext.MessageBox.alert('Error', 'Some problem occurred');},
});
This should work according to Extjs documentation, but in request-header
Content-Type application/x-www-form-urlencoded,text/javascript; charset=UTF-8
Which causes problem as my server requires post data in application/json
format and not in application/x-www-form-urlencoded
I have searched this on ext-forums too but could not get it worked.
Is there Problem in my code or its bug in extjs?
Please help.
Upvotes: 2
Views: 12431
Reputation: 5275
Everything is ok with your code because it works ok. I tested it in both IE9 and Chrome and as you can see in the image:
You can see this working here: http://tinyurl.com/afeluoy
I can´t imagine a reason why your header is not setted okay but play with the it in jsfiddle to confirm it works properly.
Upvotes: 3