Topic: Jquery $.post and returning a new page
I am using a link_to as a function to submit data from a form in a controller.
In my UJS section I have the function defined as:
function add_new_section() {
$.post("<%= new_recipe_section_path(@recipe.id) %>", $('.edit_recipe').serialize(), null, "html");
return false;
}
which is being called in the view by:
<%= link_to_function "Add New Section", "add_new_section(#{@recipe.id})" %>
The correct method in the controller is being called and executed, however, the server doesn't load a new page, it just stays on the same page (though it said it did). I think there might be an issue with the null, or "html" part.
Any thoughts?
Thanks,
R