• 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

Why do I have invalid argument supply for foreach in Laravel for json response? [duplicate]

How to use a PHP MVC Controller, one thats invoked by calling a URL, to call and execute more than one function? [duplicate]

Nginx RTMP not recording

Unsure why I am getting: Number of variables doesn't match number of parameters in prepared statement

How can I stop a symfony process which is listening on http://127.0.0.1:8000

Results page in other window

How do I refresh a DIV content?

How to convert a carbon into string, to take the date only?

How to insert Google Adsense Code in PHP script?

Laravel : How to Create Dropdown to Select FOREIGN KEY from Other Table?

How to get median and quartiles/percentiles of an array in JavaScript (or PHP)?

Error when uploading certain .png files "Interlace handling should be turned on when using png_read_image"

Passing PHP JSON to Javascript: echo json_encode vs echo json declaration

Submitting a form with ajax in Wordpress

How to install php yaml on CentOs?

About Contact Privacy policy Terms and conditions