Tuesday 15 September 2015

asp.net mvc - jquery load returns empty, possible MVC 2 problem? -


I have a site that wants to get some different data using asp.net net MVC /

The data to load are from these pages:

This should not be a banner, but for some reason I get an empty response, this is my JS:

& lt; Script & gt; JQuery.noConflict (); JQuery (document) .ready (function ($) {$ ('.totalDonations'). Load ('http://charity.hondaclassic.com/home/totaldonations'); $ ('# donation list'). Load ('Http://charity.hondaclassic.com/home/SharityList');}); & Lt; / Script & gt; In FireBug, I feel that the request is made and comes back with a reply of 200 OK but the response is empty, if you browse these pages then they work fine. Are you what is this?

Here is the administrative action from the MVC site:

  public proceedings total donation () {var total = "$" + repo.All & lt; Customers & gt; () .Sum (x => x.AmountPaid) .ostring (); Return content (total); } Public Action Result Charities () {Var Charities = Repo. All & lt; Company & gt; (); See Return (donation); }  

Someone forgets the stupid little thing that I have, please should have taken me 5 minutes and it's been hours!

Ajax prevents HTML from loading HTML. The correct way to do this would be to ask if there is a request from AJX and instead to find ways to change it.

  public execution total donation (string callback) {var total = "$" + repo All & lt; Customers & gt; (). Yoga (x = & gt; x.AmountPaid) .ostring (); If (! String.InsnaleAliquely (callback) {return content (callback + "({total:" + total + "})";); } And {return content (total); }} ... $ .getJSON ('http://charity.hondaclassic.com/home/totaldonations?callback=?', Function (data) {$ ('totalDonations') .html (data.total);}) ;  

No comments:

Post a Comment