SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    send headers after redirect: HTTP_X_REQUESTED_WITH

    Hi,

    I have built an application which reacts differently given the request context, if a page is requested asynchronously, for example.


    The problem is, when you submit a form asynchronously and redirect, the result cannot be detected with HTTP_X_REQUESTED_WITH. And my application needs to know if a redirect comes from after an asynchronous submission or not.

    I came to the conclusion that easiest way to proceed is to mimic a xmlhttprequest request in the redirect. It avoids the use of sessions.

    Is it a good idea?

    If yes, how would you add headers that do what I want?

    PHP Code:
    header('Location: '.$url);
    die(); 
    Regards,


  2. #2
    SitePoint Wizard bronze trophy
    Join Date
    Jul 2008
    Posts
    5,757
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    You could pass a query string argument.

  3. #3
    SitePoint Wizard
    Join Date
    Jan 2005
    Location
    blahblahblah
    Posts
    1,447
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I think I will go for sessions after all... It seems quite logical. I'm not sure this kind of data belongs in the query string (SEO-wise, or just for user friendliness).



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
  •