• 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

Add rows to Single product Additional information table in WooCommerce 3.6

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

How to get Laravel's CSRF Token from Another Website?

PHP 8.1: strftime() is deprecated

Symfony Error: "An exception has been thrown during the rendering of a template"

Popup Window and PHP form

Need to display only array value in JSON output

How to override header set in Apache config with more specific header in a virtual host

Laravel excel maatwebsite 3.1 import, date column in excel cell returns as unknown format number. How to solve this?

How can I create a Download Page with post php method?

Component install error: JInstaller: :Install: File does not exist

PHPS source file - 403 Forbidden You don't have permission to access this resource

How to keep value of selected value after form submission?

Split array into 4-element chunks then implode into strings

Can't call javascript alert alertify library from PHP

About Contact Privacy policy Terms and conditions