laytonsdad's Profile User Rating: -----

Reputation: 444 Architect
Group:
Contributors
Active Posts:
1,900 (1.16 per day)
Joined:
30-April 10
Profile Views:
17,690
Last Active:
User is offline Yesterday, 05:28 PM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Windows
Favorite Browser:
Chrome
Favorite Processor:
Intel
Favorite Gaming Platform:
Nintendo
Your Car:
Toyota
Dream Kudos:
300

Latest Visitors

Icon   laytonsdad Needs help with a design idea...

Posts I've Made

  1. In Topic: Jquery not loading ajax page

    Posted 28 Oct 2014

    Only the first echo will be displayed. If you want to send more than one set of data you need to concatenate it into one echo or encode it as JSON data.

    If you do send it back to the browser as JSON data be sure to parse the data as JSON when it returns.

    IE:

    PHP-
    
    // Receives post request and returns data as JSON data.
    
    if (exists($_POST)){
      echo(json_encode($_POST));
    }else{
      echo "No post data recieved!"
    }
    
    
    


    Javascript-
    $('form').on("submit", function(){
      var name = "Tim", age = 22;
    
      $.post("myPhpCode.php", {name, age}, function(data){
         console.log( JSON.parse(data) ); 
         // This will log a JSON object
         // { "name": "Tim", "age": 22 }
         // data.name === "Tim"
         // data.age === 22 
      }, "json"); // notice the data type declaration at the end of the post function
    });
    
    
  2. In Topic: Using functions

    Posted 28 Oct 2014

    Have you tried to use your console to debug the script? What errors do you find?
  3. In Topic: Jquery not loading ajax page

    Posted 28 Oct 2014

    In order for the ajax to accept anything back from the server it must be printed or echoed out from the server script.

    You are not returning (printing) any content from the last script you posted.

    Also, there is no need to bold you entire text, it does not help.
  4. In Topic: Using functions

    Posted 27 Oct 2014

    There is a good discussion here on functions.
  5. In Topic: XAMPP - apache [Not Running]

    Posted 27 Oct 2014

    This may be of help to you.

My Information

Member Title:
Cheese and Sprinkles
Age:
32 years old
Birthday:
December 28, 1981
Gender:
Location:
Temecula CA
Interests:
Coding and learning new languages
Full Name:
Dustin Parker
Years Programming:
14
Programming Languages:
HTML, CSS, PHP, JavaScript, Java, C#, ASP.net, XML, python

Contact Information

E-mail:
Click here to e-mail me
Website URL:
Website URL  http://dpwebprogramming.com
Facebook:
http://facebook.com/pagesbydustin
Twitter:
pagesbydustin

Comments

Page 1 of 1
  1. Photo

    Michael26 Icon

    02 Apr 2013 - 09:51
    Congrats on winning signature of the month. :)
Page 1 of 1