• 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

PHP7 CLI attempts to load xdebug twice - "Cannot load Xdebug - it was already loaded"

Laravel 5 issue with wherePivot

Is there a way to correctly use sanitize_text_field and wp_unslash that doesn't cause psalm to error with "expects string, possibly different type"

Doctrine ORM: Excluding Records Based on Values of Nested Relationships

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

Laravel eloquent update record without loading from database

How to redirect to another page after n seconds in wordpress without using javascript?

Get orders by date and status woocommerce

How to auto populate preferredCountries from intl-tel-input with db output

json_encode turns array into an object

how to remove white space in select 2

Store / Website Column in Magento 2 Admin Grid - Custom Module

Natural ORDER in Laravel Eloquent ORM

PHPExcel_IOFactory::createWriter causes wrong behaviour

Sum array values

About Contact Privacy policy Terms and conditions