Simple getJSON does not work...
Posted
by user54197
on Stack Overflow
See other posts from Stack Overflow
or by user54197
Published on 2010-04-30T15:13:35Z
Indexed on
2010/04/30
16:37 UTC
Read the original article
Hit count: 229
JSON function(Index) does not fire. Any Ideas?
<script type="text/javascript">
$(document).ready(function() {
alert("This alert is displayed :(");
$("form[action$='GetQuote']").submit(function() {
$.getJSON($(this).attr("action"), $(this).serialize(), function(Result) {
alert("This alert is not shown :(");
$("#name").html(Result.name);
$("#address").html(Result.address);
});
return false;
});
});
</script>
CONTROLLERS...
public JsonResult GetQuote(string dataName)
{
if (dataName != "" || dataName != null)
return new JsonResult { Data = new Result { name = "Hello", address = "World" } };
else
return null;
}
© Stack Overflow or respective owner