Posts Tagged postback
so place following code in our View (be aware that I am using Razor as my view engine)
Nice and clean… upon click the above link will do a call back to Read method of our Home controller and will replace the result from that method in Div5.
Hit F5 and this will be rendered into your browser let’s inspect the resulting HTML
<a data-ajax=”true” data-ajax-method=”Get” data-ajax-mode=”replace” data-ajax-update=”#div34″ href=”/Home/Home/Read”>
notice that behind the scene it’s using HTML5 style annotations… now click on the link and you will find that instead of doing Callback the link is simply doing a post back…. wow… what has gone wrong…. doing a little google on this suggest that we should include MicrosoftAjax.js and MicrosoftMvcAjax.js in our view but this doesn’t solves the problem… after some research I had figured that out you need to include mainly “jquery.unobtrusive-ajax.js” and it will work like a charm