I'm am unable to get the alert to fire off of the $.post aswell I am however getting the data back fine in my recieiving page. I created a seperate page with the code to execute on it. You might try creating a seperate page to hit on the $.post so you could
debug the page in visual studio and see if its even getting hit. Also have you checked in Firebug or Chrome's Javascript console for any errors?
Edit:
After reading the docs a bit more I think the reason the alert isnt getting fire is cause the page being called doesnt return any data back.
Edit:
Acutally I was wrong. The callback is getting fired its just not getting back what it expects. Change the 'json' to 'html' and the alert will fire.
$.post('BrowserService.cshtml', { data : 'mydata' },
function (data) {
alert("Data Inserted");
},'html');
Jessemlay
Member
24 Points
14 Posts
Re: jQuery inside Razor
Apr 07, 2011 01:45 PM|LINK
I'm am unable to get the alert to fire off of the $.post aswell I am however getting the data back fine in my recieiving page. I created a seperate page with the code to execute on it. You might try creating a seperate page to hit on the $.post so you could debug the page in visual studio and see if its even getting hit. Also have you checked in Firebug or Chrome's Javascript console for any errors?
Edit:
After reading the docs a bit more I think the reason the alert isnt getting fire is cause the page being called doesnt return any data back.
Edit:
Acutally I was wrong. The callback is getting fired its just not getting back what it expects. Change the 'json' to 'html' and the alert will fire.
$.post('BrowserService.cshtml', { data : 'mydata' }, function (data) { alert("Data Inserted"); },'html');