• 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

How do I refresh a DIV content?

GuzzleHttp Hangs When Using Localhost

Detect emoticons in string

Add a custom text for a particular product on specific email notification in Woocommerce

PHP Deprecated issue when running artisan command

PhpSpreadSheet: How to save Workbook sheets in individual CSV files

PDOException SQLSTATE[HY000] [2002] No such file or directory

Alert message after submitting form in PHP

Pass an image through AJAX [duplicate]

Do I need to install `fxp/composer-asset-plugin` if I'm not doing front-end development

How to fix Call to undefined method AppModelsTableName::factory?

HTTP Range requests with php for Video Embedding for solving going to specific time in video (seek bar not work)

PHP - CURL using HTTPS [closed]

get data-value with variable value

Can't call javascript alert alertify library from PHP

About Contact Privacy policy Terms and conditions