Manu Manu - 1 year ago 66
Javascript Question

I am having issue with handlebars. Its not compiling the data

I've shifted my server, Handlebar is working fine on my previous server. The same code is not working on my new linux server. Data is not being compile.

My json response is fine its returning data properly. Any guide please!


var $deferredsLocal = [];
$deferredsLocal[0] = $.ajax({ url: tabUrl, type: "POST"});
$deferredsLocal[1] = $.ajax({url: 'templates/tabs_contact_detail.html', type: "GET", cache: true});
$.when.apply(null, $deferredsLocal).then(function (json, htm) {
var htmls = htm[0];
var template = Handlebars.compile(htmls);
var completeHtml = template(json[0]);


$('#content').find('td.question_label').each(function (index, element) {

// tabUrl is returning json response

Answer Source

Hi Guys there was json format issue. The data i was getting was looking into json format but it was not in json actually. I just moved the header: header('Content-Type: application/json'); up and placed it in the start of my code.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download