• 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

Laravel 5.1 how to use {{ old('') }} helper on blade file for radio inputs

Yii2 redirecting to previous page after login

What is PHP's equivalent of JavaScript's "array.every()"?

Get Header Authorization value of a login api (sent with username and password in json body) using php curl

dockerizing Laravel + vue

Codeigniter, Severity: error --> Exception: Too few arguments to function, admin dashboard shows HTTP error 500

Best way to scrolldown onpageload

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

merge all files in directory to one text file

Symfony/Form add attribute based on the data

Only on Firefox "Loading failed for the <script> with source"

How to use React Router with Laravel?

Laravel 5.1 xmlHttpRequest AJAX POST TokenMismatchException

Respond with status code 401 on authentication failure using Laravel and Passport?

Show date difference as "20" instead of "20 years ago"

About Contact Privacy policy Terms and conditions