• 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

Ajax GET request fails in laravel 8

How can I easily switch between PHP versions on Mac OSX?

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

WHERE IN array binding in DB::raw laravel 5.4

Use same method for inertia response and json response Laravel Jetstream

Convert every two values of an associative array into key-value pairs

Redirect to previous page with php

Open a popup box after receiving result from ajax

Laravel set default language not working

How to insert data from multiple select dropdown values into database?

How to reset Laravel AuthManager/guards in between API calls in tests?

How to update array value in Laravel

Creating live search with AJAX and CodeIgniter

Why does using salted hash on python and php give me different results?

Wordpress how to get the post thumbnail inside a figure tag

About Contact Privacy policy Terms and conditions