• 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 to use PHPCBF to fix one issue at a time?

Artisan, creating tables in database

Is there a way to use Foundry Model for Authentification inside Functional Tests?

Send same name multiple checkbox values via ajax

Merge key and value of array index [duplicate]

Laravel 4 Redirect::back() not going to previous page (refreshing current page)

WooCommerce: Add/display Product or Variation custom field everywhere

disable two buttons after clicking another button

How to fix " Uncaught TypeError: Argument 1 passed to JpGraphException::defaultHandler() " problem in php 7.1.3 and jpgraph 4.2.6?

Jquery DataTables: Data not displaying in table via Ajax

Multiply each value in array using array_map function

Open a popup box after receiving result from ajax

Unable to guess the mime type as no guessers are available Laravel 5.2

Can't call javascript alert alertify library from PHP

How to debug in WooCommerce 3+

About Contact Privacy policy Terms and conditions