Jul 23, 2011, 12:25 AM
[CLOSED] MVC application absolute/relative urls in javascript ajax requests
I have an MVC application where I need to make Ajax calls to various controller actions. What is the best way to handle the path to the controller actions relative to the host page where these actions are launched from? Does Ext.net have anything built in that I could use?
For instance, I currently have the following call which I don't like and I want to change in order to be immune to the path of the parent page:
url: Ext.ResolveUrl(' ~/Applications/GetApplicationData')
Thanks
For instance, I currently have the following call which I don't like and I want to change in order to be immune to the path of the parent page:
Ext.Ajax.request({
url: '../../Applications/GetApplicationData',
method: 'POST',
params: {
'organizationId': this.selectedOrganizationId,
'applicationId': this.selectedApplicationId,
'storeRequestsInfo': Ext.encode(storeRequests)
},
success: function onSuccess(result, request)
{
...
},
failure: function (result, request)
{
....
}
});
Instead of using '../../Applications/GetApplicationData' I would like to use ' ~/Applications/GetApplicationData' as I would normally use in .Net. However, Javascript doesn't know what ~ means, so I was hoping that perhaps Ext provides some javascript function that would know what to do with ~, something like:url: Ext.ResolveUrl(' ~/Applications/GetApplicationData')
Thanks
Last edited by Daniil; Jul 25, 2011 at 6:47 PM.
Reason: [CLOSED]