Jul 18, 2013, 3:38 AM
[CLOSED] pass json data in the Ajax store proxy
Hi, I have been constantly working on the following issue , with a positivity of finding a solution, but in vain.
So here is the issue:
I am trying to find if I can pass a typical json formatted string in the store proxy request body. like I want to implement the following jquery ajax call in the ext.net store proxy
And the json string will be something like this -
And finally, here is the Store proxy:
Thanks a lot !
Veda
So here is the issue:
I am trying to find if I can pass a typical json formatted string in the store proxy request body. like I want to implement the following jquery ajax call in the ext.net store proxy
var Url = "/OperationalControlServices/Service1/data/MuseumComponentDetails";
var request = $.ajax({
url: Url,
type: 'post',
dataType: 'json',
contentType: 'application/json; charset=utf-8',
data: JSON.stringify({ json: jsonString, json2: jsonString2 })
});
especially the ext.net mode of implementing the "data:" part in the above jquery is needed for me.And the json string will be something like this -
{"json":"[{"PROJECT_ID":"2","PROJECT_NAME":"ABCD","PROJECT_DESC":"ABCD","PROJECT_STATUS_ID":"1","REMEDIATION_ID":"1","REMEDIATION_DATE":"11/20/2013 12:00:00 AM","DATE_TYPE":"Date","CONTACT_ID":"2","SID":"123456","MUSEUM_LIST":"1,6,14"}]"}
I have tried to set the root to "json" ( this json is the parameter name as you can find in the above string.), & also tried various possibilities...but no luck...:(And finally, here is the Store proxy:
Ext.Net.Store resultStore = new Ext.Net.Store()
{
AutoLoad = autoLoad,
Proxy =
{
new AjaxProxy()
{
Json = true,
ActionMethods = { Read = Ext.Net.HttpMethod.POST, Create = Ext.Net.HttpMethod.POST},
Url = proxyUrl,
Headers = {
new Ext.Net.Parameter("Accept", "application/json"),
new Ext.Net.Parameter("Content-Type", "application/json")
},
Reader = { new Ext.Net.JsonReader() { Root = "" } },
Writer = {
new Ext.Net.JsonWriter()
{
Root="json", Encode=true // this is what I tried to do..this "json" is the parameter name in the above given json string.
}
} ,
}
}
};
Hoping to get a fix soon ! :)Thanks a lot !
Veda
Last edited by Daniil; Jul 18, 2013 at 4:27 PM.
Reason: Please use [CODE] tags, [CLOSED]