-1

I just watch this video and others video. All of them use ajax with 2 .php files but i already have file content.html that contain forms and content.php that submit form to database. how can i use ajax with my html file to submit form without reloading page. https://www.youtube.com/watch?v=IOONJgPclwU

Splicee
  • 63
  • 7
  • You can just use ajax to this. Here you can find more info http://stackoverflow.com/a/5004276/6357312 – Arkowsky Jan 24 '17 at 06:09

2 Answers2

0

Utilizing the jQuery library you can use code like

$("#theForm").ajaxSubmit({url: 'server.php', type: 'post'})

Please reference jQuery AJAX submit form as it answers your question very well.

Community
  • 1
  • 1
0

This is not a new question but still you can take help from this code

$(document).ready(function(){
 $("button").click(function(){
    $.ajax({url: "submit_form.php", success: function(result){
        $("#div1").html(result);
    }});
 });
});
Shubhranshu
  • 501
  • 3
  • 12