Thanks for the input guys, smart way of dealing with the issue. So you basically assume that you're not adding any AJAX at first, and then you use JavaScript (jQuery is my library of choice) and intercept the request. Finally use the event.preventDefault() method to stop the standard request and inform the browser that the request has been taken care of. I like it...
I assume that would work very nicely when using PHP. But I need some advice from someone who knows ASP.NET MVC... As you might know, the ActionResult of a standard request could be different from that of an AJAX request. I was thinking of maybe doing the following:
public ActionResult DoSomething() {
if(Request.IsAjaxRequest()) {
//prepare the result
return Json(result);
} else {
//prepare the result
return View(viewModel);
}
}
Or maybe I could separate that method into two. One called DoSomething() for standard requests, and DoAJAXSomething() for AJAX requests. But in this case, how do I handle that in my View file?
rahmu wroteGod, I miss web development ...
You gotta love web development. It's literally addictive ;)
@Admin: could we get some code editor with code and tabbing when trying to post some code?