<div class="grid--cell fl1 lh-lg">
<div class="grid--cell fl1 lh-lg">
This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, <a href="/help/reopen-questions">visit the help center</a>.
</div>
</div>
</div>
<div class="grid--cell mb0 mt8">Closed <span title="2013-03-07 05:52:02Z" class="relativetime">7 years ago</span>.</div>
</div>
</aside>
I have a function called UpdateBoatTable, which is supposted to update a HTML Template via jsRender. The function looks like following:
$.fn.UpdateBoatTable = function()
{
$.ajax({
url: "backend/boat.php?a=show",
datatype: "json",
success: function(data)
{
alert(data);
$("#BoatList").html
(
$("#BoatTemplate").render(data)
);
}
});
}
The MessageBox (alert(data)) is returning the following value:
[{"BoatID":"2","RegNo":"Registration Number","BoatName":"Boatname","BoatType":"Type"}]
But rendering the data to a template fails.
If i am going to hard code the json data, it works...
$.fn.UpdateBoatTable = function()
{
$.ajax({
url: "backend/boat.php?a=show",
datatype: "json",
success: function(data)
{
var data = [{"BoatID":"2","RegNo":"Registration Number","BoatName":"Boatname","BoatType":"Type"}];
alert(data);
$("#BoatList").html
(
$("#BoatTemplate").render(data)
);
}
});
}
Can you tell me why it is only working if it is hardcoded?
Thank you very much!
</div>
Typo, datatype: "json",
should be dataType: "json",