/*
Part of the code for the article "Use Ajax and PHP to Build Your Mailing List"
by Aarron Walter (aarron@aarronwalter.com)
http://www.sitepoint.com/article/use-ajax-php-build-mailing-list
*/

// Attach handler to window load event
$(document).ready(function(){  
$("#submitemail").click(function(){ 

	var name = $('input[name=address]');
  // Update user interface
  $('response').innerHTML = 'Adding email address...';
  // Prepare query string and send AJAX request
  var pars = 'address=' + name.val()

  $.ajax( {
  type: 'get',
  url: "http://www.slashprices.co.uk/wp-content/themes/slashprices/newsletter/subscribe/ajaxServer.php",
  data: pars,
  cache: false,
  success: function( r ) {
    $('#response').html( r );
    
  }
} );
  // Stop form from submitting when JavaScript is enabled
 
  return false;  
    });   
});   
