Treehouse: Grow your CSS skills. Land your dream job.

Get output from php using jquery

  • # March 6, 2010 at 12:20 pm

    I’ve been looking into $.post, $.get, and $.ajax to get my desired result but I can’t seem to make headway. Here is what I’m trying to accomplish:

    3 files: index.php, file.js, output.php

    user inputs text in a box

    using .change() or .blur() the jquery pulls in the text and sends the value to output.php.

    takes the value and compares it to an array. if a match is found a message is displayed on index.php

    I have all the pieces of the puzzle. Just can’t quite to get them to fit. Any ideas?

    # March 6, 2010 at 1:12 pm

    probably need a little more info than that to be honest :) Can you give any more detail?

    # March 6, 2010 at 2:00 pm

    Basically the form will store data to a database. I’m trying to dynamically check to ensure the field pageName doesn’t already exist.

    When the user enters text into the textbox and loses focus I want the jquery/javascript to send the value of the textbox to php, have php check if the name is on the database by pulling the names with a select query and comparing the results. if a match is found a message that says "name exists" will display next to the textbox.

    # March 6, 2010 at 3:02 pm

    this might help you lots :) … query.html

    # March 6, 2010 at 3:59 pm

    yep! perfect. Turns out my code was almost spot on. Had to make a few adjustments that I didn’t see. thanks!

    # March 6, 2010 at 5:47 pm

    awesome :D

Viewing 6 posts - 1 through 6 (of 6 total)

You must be logged in to reply to this topic.