SitePoint Sponsor

User Tag List

Results 1 to 2 of 2
  1. #1
    SitePoint Member
    Join Date
    Feb 2009
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    AJAX Echo vs Header

    Hey,

    I'm trying to layer in some ajax functionality (via jQuery) atop of some php pages to make the experience more seamless.

    I'm using two php pages, one to post the info and one to process. Once the process is done it uses header() to return to the first page.

    I am then adding jQuery to interpose and post the data 'behind the scenes'... fine, but since my basic php pattern isn't using echo, how do I get the response text back to my ajax request?

    Do I have to add a hidden input to the html that JS can 'set' so that php knows... 'hey, this is an ajax thing, so I'll use echo' vs 'hey, this is standard php, so do the header thing'?

    Degrading gracefully is hard (for me)! Any insight would be much appreciated! =)

    - JK

  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    jquery sends an X-Requested-With header for ajax requests, or you can set your own header or field.


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
  •