Hey all,
So I’m running into an issue with jquery when making an ajax call to
retrieve a string. It comes back displaying the entire chunk of code
rather than rendering it in my erb file… I’m confused.
Here’s the actual code hopefully someone can help before I pull my
hair out.
----results.js—
$(function() {
$(".search_box").live(“keyup”, function() {
$.getScript("/javascripts/index.js.erb");
return false;
});
});
— index.js.erb —
$("#jresults").html(’<%= escape_javascript(erb(:results, :layout =>
false)) %>’);
This works for the most part but the <%= escape_javascript(erb
(:results, :layout => false)) %> actually displays in my view when I
call for the update. Looking at the source it looks like the original
data is there also.
Has anyone ran into this before? I’m sure it’s a big red truck but
right I can’t figure it out for the life of me.
OH and before I forget I’m using Sinatra for this app.