• Categories
    • PHP
    • phpMyAdmin
    • PHPMailer
    • FFMpeg
    • PHPEXcel
    • PHPDoc
    • PHPUnit
    • CakePHP
    • CakePHP 2.0
    • Cake PHP 2.1
    • CakePHP Model
    • Facebook PHP SDK
    • composer-php
    • PHP 7
    • PHP GD
    All Categories
  • About

How to get AJAX to post on second page?

javascriptphpjqueryajax


PHP Snippet 1:

$( document ).ready(function() {

$("button").click(function() {
var dataPoint = "chunk of data";
    ///////// AJAX //////// AJAX //////////
        $.ajax({
            type: 'POST',
            url:  'some_page_name.php',
            data: {dataPoint:dataPoint},
            success: function( response ){
                $('#success').html("Sent!!");
            }
        });
    ///////// AJAX //////// AJAX /////////

  });

PHP Snippet 2:

<button>Click me</button>
<div id="success"></div>

Related Snippets

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

JQuery content editable div and text box on submit not sending POST

Get data from accuweather api url

Uncaught TypeError: Cannot read property 'length' of null when retrieving tags from wp

possible options to create pdf file using html elements to generate invoice in php and codeigniter

Google Gmail API - How to login programatically?

loop through an anchor id

PHP to search within txt file and echo the whole line

hidden INPUT value not available in $_POST

Laravel views are showing from cache on one server but works fine on other server

How do I call a php file with axios?

Remove "estimated for {country}" text after tax amount in Woocommerce checkout page

Display the default discounted price and percentage on Woocommerce products

how to sort by a custom appended relation to model

cakephp save drag and drop list order to database

About Contact Privacy policy Terms and conditions