Ajax submission on page load

MineSQL

I'm trying to create a test script for a small little website I'm doing, and it requires a lot of troubleshooting with this particular form. In order to get a response, I need to fill out 5 step form wizard and then wait for the results. I've been trying to create a small little script I can use on a seperate page to test my php functions in a heartbeat. Here is what I have so far, and it doesn't seem to even post to the page.

<div id="response"></div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.0.3/jquery.min.js"></script>
<script>
$(document).ready(function(){
    var data = {
        console: "playstation",
        game: "FIFA14",
        coinamount: "10000",
        team: "Some Team Name",
        league: "Some League Name",
        player: "Some Player Name",
        quality: "Silver",
        chemistry: "Basic",
        position: "CAM",
        customername: "Joey Small",
        customeremail: "[email protected]",
        customerphonenumber: "23454343534",
        payment: "pp"
    }
$.ajax({
    type: "POST",
    url: "order.php",
    data: data,
    cache: false,
    contentType: false,
    processData: false,
    success:  function(data){
        $("#response").html(data);
    }
});
});
</script>

I'm inspecting the network data in my browser, and it is not sending to order.php. I don't have much love for javascript, especially Jquery, so any help would be greatly appreciated.

MineSQL

Ok, so the additional options added on to the end are what is making the script not submit.

$.ajax({
    type: "POST",
    url: "order.php",
    data: data,
    success:  function(data){
        //alert("---"+data);
        $("#response").html(data);
    }
});

That works correctly. Daedalus's comment got me to thinking about the additional tags, and how they are not needed.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Dev

jquery load vs ajax for form post submission

From Dev

Form submission using ajax and page view moderation after the submission

From Dev

Load ajax after page load

From Dev

AJAX load and page scrolling

From Dev

Load part page with jQuery & AJAX

From Dev

Ajax call after page load

From Dev

ajax load page without cache

From Dev

Ajax load page without refresh

From Dev

jquery ajax page load how?

From Dev

Ajax call before page load

From Dev

ajax load page without cache

From Dev

Getting Page Load Progress with Ajax

From Dev

Why Ajax.BeginForm redirect to new empty page after submission?

From Dev

Using jQuery AJAX to call a php page on form submission

From Dev

jQuery - stop form submission from changing page using ajax

From Dev

Don't reload page after form submission using ajax and jquery

From Dev

Load page with Ajax and load new scripts if necessary

From Dev

Load page Ajax and then slide it into page OR plugin

From Dev

Load page with ajax and scroll to loaded page anchor

From Dev

Load Visual Composer on Every Page (AJAX Setup)

From Dev

AJAX get query not causing page to load

From Dev

Make Ajax call after page load

From Dev

How to use ajax to load new page into div

From Dev

How to load a PHP page into a div with jQuery and AJAX?

From Dev

Ajax call does not load the page but goes into .fail?

From Dev

Page Load alternative in a Pure HTML AJAX Website

From Dev

How to load a portion of a Page Using Ajax in JQuery?

From Dev

ajax popup load from another page

From Dev

How to load a part of a page using ajax in codeigniter