SitePoint Sponsor

User Tag List

Results 1 to 9 of 9
  1. #1
    SitePoint Zealot Jafar's Avatar
    Join Date
    Jun 2005
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    PHP and ajax question?

    Hi,
    I used ajax for submitting my form and action page will display in my form page.
    I want to display just a certain part of action page content, for example the result of submitting (a true or false string) not whole of the page.
    how i can do that?
    also i want to search a certain phrase when page loaded using php, how can do that too?

    thanks
    regards

  2. #2
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think since you can use PHP code in your action file, with the help of some condition, you can print some portion only.
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  3. #3
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    can you give us some code to work with Jafar?
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  4. #4
    rajug.replace('Raju Gautam'); bronze trophy Raju Gautam's Avatar
    Join Date
    Oct 2006
    Location
    Kathmandu, Nepal
    Posts
    4,013
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    can you give us some code to work with Jafar?
    Are you, spikeZ , asking me to give the code??
    Mistakes are proof that you are trying.....
    ------------------------------------------------------------------------
    PSD to HTML - SlicingArt.com | Personal Blog | ZCE - PHP 5

  5. #5
    SitePoint Wizard cranial-bore's Avatar
    Join Date
    Jan 2002
    Location
    Australia
    Posts
    2,634
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Are you, spikeZ , asking me to give the code??
    No, he's asking Jafar for the code. You can tell because his request ends with the word Jafar and a question mark.

    Jafar, I like to send a paramater in the URL to the form action page to indicate an ajax request. It responds differently by only outputting the true/false text and then calling exit to avoid returning the whole page to Javascript.

    If you are hijacking your form submission with JS, and capturing the action URL just append ?ajax=1 and modify your form action script to check for $_GET['ajax']

  6. #6
    dooby dooby doo silver trophybronze trophy
    spikeZ's Avatar
    Join Date
    Aug 2004
    Location
    Manchester UK
    Posts
    13,788
    Mentioned
    151 Post(s)
    Tagged
    3 Thread(s)
    Quote Originally Posted by cranial-bore View Post
    No, he's asking Jafar for the code. You can tell because his request ends with the word Jafar and a question mark.
    cryin laffin here!
    Mike Swiffin - Community Team Advisor
    Only a woman can read between the lines of a one word answer.....

  7. #7
    SitePoint Zealot Jafar's Avatar
    Join Date
    Jun 2005
    Posts
    160
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks,
    I have not any control on action file because it is on other server.
    i am trying to insert data from my own form in localhost and use ajax to control what will happen in action file.
    since response of action file have a lot of extra information i want to select parts of text that i need for next decide.

    let me know if you think that a sample code is necessary yet.

  8. #8
    SitePoint Zealot glowdot's Avatar
    Join Date
    Jun 2007
    Location
    Santa Monica, CA
    Posts
    111
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If your "action" file is on another server, I don't believe AJAX is going to work for you here. What you probably want to do is have your local script make a request to the other script using include() or file() or something like that, with the data encoded in the query string.
    Advertise on Glowfoto
    banners as low as $25/month, text ads $10/month
    Share 10 million impressions per month!

  9. #9
    SitePoint Addict Php_penguin's Avatar
    Join Date
    Aug 2004
    Location
    Colwyn Bay, Wales, UK
    Posts
    287
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    if the string is enclosed in a uniquely identifiable tag, you could use the DOM (or jQuery) to extract it.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •