• 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

If you intend you use SMTP, add your SMTP Code after this Line

PHP Get value from JSON [duplicate]

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

How to disable widget block editor of WordPress?

Laravel display validation error

phpunit - testing is painfully slow

Reload parent page after submit in iframe

Getting public posts of a random user from Facebook API

Facebook API, get page post link (PHP)

Symfony - "framework.test" config is not set to true

Extract string between first whitespace and last whitespace in php

how to create html table in php

storagelogs/laravel.log" could not be opened in append mode: failed to open stream: Permission denied

Laravel insert dynamic input values with radio button

How in Laravel run JavaScript code stored in php variable?

About Contact Privacy policy Terms and conditions