I have a website that uses many ajax requests to show data. One of which is a messages view.
The user gets notified by email when he gets a new message, the link I provide is something like this: /mailmessages/show/67?layout=true
The layout=true parameter decides if a layout is rendered or not. With an ajax call it’s false.
Is this the way to do it? Or is there a better solution for this. Putting the parameter everywhere doesn’t feel like a good solution.
Edit: I’m using plain jquery ajax calls, not any microsoft solution.
You could check :
And render differently based on that.
EDIT
Then you could check Request.Headers[“X-Requested-With”] – it should be XMLHttpRequest if it’s ajax.
To be sure do a debug and see what header jQuery sets, and also check if just using IsAjaxRequest works 🙂 (the same header as ms ajax will probably be set).