[Fixed]-Jquery ajax call redirects to called url insted of same template

1👍

Your scripts had JS errors and it is submitted. Here is what you need to do to address this. Read inline comments.

frm.on('submit', function(event){
  event.preventDefault(); //Prevents the default action from happening and Rayon mentioned 
  create(frm);
});

Fix your JS errors in success function. Remember JS errors may fail your whole app.

 success : function(response) {
        if(response.status == "success"){
            var success_message = "<div>some success message</div>"; //This line had error in your code
            $('#container_body').html(success_message);
        } //You don't need a semicolon here

        if(response.status == "error"){
           frm.find('.results').html("<div class='alert alert-mini alert-danger'>"+response.message+"</div>");
        } //You don't need a semicolon here 
    }// You dont need the redundant comma here which will error out in IE

Leave a comment