MVC: Calling ajax data with different url parameter
MVC: Calling ajax data with different url parameter

Hi
I have to call up ajax data with mvc parameters (ie different url) the values of which change based on the values users select from a select field. I notice that if I make another call to the same js function I used for initialising the editor, and pass it different values for intCdrFrmtSrc1, intCdrFrmtTpe1 and strCdrFrmtNme1 below the controller seems to show the same values that were used with the 1st initialising call.
ajax: { //works
url: '/CDRData/CRUDCDRDataAndFiles/' + intCdrFrmtSrc1.toString() + '/' + intCdrFrmtTpe1.toString() + '/' + strCdrFrmtNme1,
},
How do I call up different ajax data again using mvc parameters in an url? Thanks
Answers
Hi @dynasoft ,
Yep,
will only use the values as they were when the table was initialised, effectively making them constants.
If you make
ajax.url
a function, it will get the current values, something like:Cheers,
Colin
Thanks! Will try that.
Hi
Is this how this should be used:
Replace:
with:
CRUDCDRDataAndFiles1 is called at and after initialisation.
But I'm getting error Failed to load resource: the server responded with a status of 404 (Not Found) http://localhost:6301/CDRData/function()%20%7B%20return%20'/CDRData/CRUDCDRDataAndFiles/'%20+%20intCdrFrmtSrc1.toString()%20+%20'/'%20+%20intCdrFrmtTpe1.toString()%20+%20'/'%20+%20strCdrFrmtNme1%7D
If you want to change the URL after initialisation you have to use
ajax.url()
to set the value.jQuery doesn't allow
ajax.url
to be a function. Colin was thinking ofajax
which can be a function, but it sounds like you just want to change the URL, soajax.url()
is how to do it.Allan
Apologies for that, @dynasoft, I did think it could be a function. Note, you use
ajax()
to change Editor's URL.Cheers,
Colin
Hi
I had another issue and came up with a solution that fixes this as well:
Thank you for the help provided.