• 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 keep value of selected value after form submission?

How to map the two arrays with a duplicate value?

PHP 8 - libxml_disable_entity_loader() has been deprecated. How do I replace the functionality it provides?

Too few arguments to function PendingResourceRegistration::name(),1 passed in C:xampphtdocsproject outesweb.php on line 18 and exactly 2 expected

How do I pass the dynamic output of a php variable or php function to a CSS variable?

Dynamic dropdown Ajax PHP request

Whats the point of running Laravel with the command 'php artisan serve'?

Add restriction to WooCommerce coupons by allowed user ID

protect images from being copied

phpunit - testing is painfully slow

insert multiple rows in a saveall in cakephp

How to insert Google Adsense Code in PHP script?

get folder directory from input type file - PHP

Laravel insert dynamic input values with radio button

Get orders by date and status woocommerce

About Contact Privacy policy Terms and conditions