×

Welcome to TagMyCode

Please login or create account to add a snippet.
0
0
 
0
Language: Javascript
Posted by: Marosi Dóra
Added: Aug 24, 2017 9:48 AM
Views: 3
Tags: no tags
  1.  $("#submit_data").click(function(e) {
  2.     e.preventDefault();
  3.     var name = $("#name").val();
  4.     var email = $("#email").val();
  5.     var dataString = 'name='+name+'&email='+email;
  6.     $.ajax({
  7.       type: 'POST',
  8.       data: dataString,
  9.       url: 'save_newsletter.php',
  10.       success:function(data) {
  11.             console.log ("success: " + data);
  12.       },
  13.       error:function(data) {
  14.             console.log ("error: "+data);
  15.       }
  16.     });
  17.  });