asp.net mvc - JsonResult is returning view html rather than a serialized object when called from jQuery Get() -


I am trying to get a json serial object from within an MVC user control using jQuery. The problem is that the coming result is the complete HTML for the page in which I have control. Pages and controls use the same controller I have tried to break the method which I am calling in the controller and never gets hit. I have tried different avatars of jQuery Ajax Calls, and get the same results.

jQuery code:

  & lt; Script type = "text / javascript" & gt; $ ('# Project_GeneralContractor_Id') Change (function () {// warning ('& lt;% = Url.Action ("GetGeneralContractor", "Projects")%>; $ .get (' & lt;% = Url.Action ("GetGeneralContractor", "Projects")%>, {id: $ ('# Project_GeneralContractor_Id'). Val ()}, function (data) {warning (data);})}} & lt; / Script & gt;  

Controller code:

  Public JsonResult GetGeneralContractor {Ent ID} {back to Json (_GeneralContractorRepository.Get (id))}  

Where $ ('# Project_GeneralContractor_Id') returns a single drop-down list and _GeneralContractorRepository.Get (ID) gives a single general content object.

Not sure That's what I have but what's going on, but I doubt the jQuery side because I can not get a break in the controller. Have you tried to experiment?

If it is not, then I bend to server side issues. It is difficult to guess without seeing the page, though it is being returned.


Comments

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -