javascript - Not getting response in ajax success function -
javascript code:
window.gettablecontent = function() { $.ajax({ url: "/oeb_infos/" + $("#oeb_info_id").val() + "/show_toc.js", type: "get", async: false, success: function(data) { alert(typeof data); if (data) { data = $.parsejson(data); $("#toc.toc").html("<ul>"); $.each(data, function(header) { var value; value = ''; $.each(header.list, function(j) { return value = value + "<ul>"; }); value = value + ("<li><a href='#" + toc_part['id'] + "'>" + toc_part['value'] + "</a></li>"); $.each(header['list'], function(j) { return value = value + "</ul>"; }); $("#toc.toc").append(value); }); $("#toc.toc").append("</ul>"); } } }); };
my rails code:
@info = oebinfo.find(params[:id]) respond_to |format| format.js render js: @info.toc_book_json end end
not getting response in ajax success function. getting empty object done, complete, success, error.. getting response in responsetext. problem? can me on solve it.
Comments
Post a Comment