I am calling asp.net action from proxy to fill the store data.
I am specifying the url correctly but on make get request to Action it is appending query string params to the call. This is resulting in 404 error.
I am posting my code below,
Asp.net mvc Action
public JsonResult SongsList()
{
List<MusicFileModel> musicFileModels = MusicFileModel.GetAllMusicFiles();
return Json(musicFileModels, JsonRequestBehavior.AllowGet);
}
Store definition in Sencha Touch 2
Ext.define('CloudPlayerUI.store.Songs', {
extend: 'Ext.data.Store',
config: {
model:'CloudPlayerUI.model.song',
proxy: {
type: 'ajax',
url: '/Home/SongsList',
param:'',
reader: {
type: 'json'
}
},
autoLoad:true
}
});
This is the ajax call that is made.
GET http://localhost/Home/SongsList?_dc=1333338051329&page=1&start=0&limit=25
I am assuming that because, Action doesn’t have any params which is being made my ajax call
it is resulting in an 404 error.
I am not sure the correct way of calling mvc action. Please let me know if I am going wrong.
Any help is appreciated.
update:
I tried adding the same query string params to asp.net mvc action. Still it is causing 404 error. When I open the same url without any query string params in new tab it is returning me Json result.
I figured out the issue.
The 404 error was due to incorrect URL config param defined in the store. Also I added a rootProperty to reader.
This is how the proxy code looks like.