• 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 session not persisting after user is logged in

How can I format this number correctly using PHP?

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

PHPUnit gives error: Target [IlluminateContractsViewFactory] is not instantiable

Target class controller does not exist - Laravel 8

Shopify password update using Shopify API

How to make a foreign key not using primary key

Transpose csv file data [duplicate]

Session timeout in Yii2

Composer Warning: openssl extension is missing. How to enable in WAMP

Confirm Leave on External Links in Wordpress

I want a way to give path to my files which are outside of public folder in laravel

Malformed MIME header error in Symfony 5.3

Composer Script echo

CodeIgniter 4: Like and Dislike Functionality

About Contact Privacy policy Terms and conditions