• 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

Require a class from another class - php

display WooCommerce “Add to cart” button with short-code [add_to_cart ] dynamically

php 7 php.ini upload_max_filesize not working

target [LaravelFortifyContractsRegisterViewResponse] is not instantiable

How to make a foreign key not using primary key

RuntimeException: Unable to create the cache directory (/var/www/sonata/app/cache/dev)

Target Laravelista is not instantiable

How to fix this error : Ask your hosting provider to use PHP 7.2.5 or higher for both HTTP and CLI?

How to test a php login connected to a mysql db through xampp?

PHP: Calling MySQL Stored Procedure with Both INPUT AND OUTPUT Parameters (NOT "INOUT")

How to submit the custom form data in database in WordPress without plugin using ajax?

How to install php yaml on CentOs?

Add 2 Webcam in one page with WebcamJS

PHP block shortcut in Visual Studio Code

WAMP/Wordpress - cURL error 28: Operation timed out after 10001 milliseconds with 0 bytes received

About Contact Privacy policy Terms and conditions