Note that there are some explanatory texts on larger screens.

plurals
  1. POMVC3 jQuery getJSON doesnt issue a call
    primarykey
    data
    text
    <p>I am trying to make ajax work using getJSON() call. When I navigate to /Home/GetWeather, I get Json data back in the browser. However the jQuery call is not working. Any ideas? When I put a breakpoint on alert("Hello"), it never hit. In firebug I dont see any ajax call. Any ideas?</p> <pre><code>$(document).ready(function() { $("#Button1").click(function() { $.getJSON("/Home/GetWeather", null, function(data) { alert("Hello"); }); }); });​ </code></pre> <p><strong>Controller code</strong></p> <pre><code>public class HomeController : Controller { // // GET: /Home/ public ActionResult Index() { return View(); } public JsonResult GetWeather() { List&lt;Weather&gt; weather = new List&lt;Weather&gt;(); // populate weather with data return Json(weather, JsonRequestBehavior.AllowGet); } } </code></pre> <p><strong>View:</strong></p> <pre><code>@{ Layout = null; } &lt;!DOCTYPE html&gt; &lt;html&gt; &lt;head&gt; &lt;title&gt;Index&lt;/title&gt; &lt;script src="../../Scripts/jquery-1.5.1.min.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script src="../../Scripts/jquery-1.5.1-vsdoc.js" type="text/javascript"&gt;&lt;/script&gt; &lt;script type="text/javascript"&gt; $(document).ready(function () { $("#Button1").click(function () { $.getJSON("/Home/GetWeather", null, function (data) { //I hit breakpoint here, but in firebug I dont see any call, nothing alert("Hello"); // Breakpoint here doesnt hit :( }); }); }); &lt;/script&gt; &lt;/head&gt; &lt;body&gt; &lt;input id="Button1" type="button" name="Button1" value="Get Weather" /&gt; &lt;div id="Weather"&gt;&lt;/div&gt; &lt;/body&gt; &lt;/html&gt; </code></pre> <p><strong>Any reason why the solution I found was removed ???</strong></p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload