• 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

Zig-zag scan an N x N array

Is it possible to re-use an array taken from PHP via JSON in a $.ajax function?

renameColumn migration fails for existing column with columns does not exist error

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

Mysqli multi query error

What is the function of the (new Date()).getTime() in PHP?

Submitting a form with ajax in Wordpress

Server-sent events in PHP (without echo or print)

Reload parent page after submit in iframe

How to load Codeigniter 4 lang file into an array variable

Insert And Retrieve Data in MySQL with $.post Noob Question

yii2 and mssql insert varbinary into model

add " ? " in url via htaccess RewriteRule

How to override htaccees file for cache control header

SendGrid: Sending an email to multiple recipients without other emails being shown on the "to" field

About Contact Privacy policy Terms and conditions