Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums JavaScript How to separate PHP content returned in an AJAX Jquery POST function

  • This topic is empty.
Viewing 3 posts - 16 through 18 (of 18 total)
  • Author
    Posts
  • #52367
    fjorko
    Member

    I did something completely different now to separate the content returned by the Jquery POST callback…

    In the callback, I receive just ONE echo and that is a confirmation that the user is logged on ( after running some backend PHP validation ). On this conformation I have a link that ( when clicked ) only refreshes the page, upon refreshing, the PHP Session will pick up that the user is logged on and display the content the user is allowed to see, by embedding the PHP tags and only echo’ing content based on the condition that the user’s Session exist.

    Not sure if it is the most elegant way to do this, but it works for me.

    Thanks for everyone’s input. Much appreciated.

    #120211
    lindsmcw
    Member

    Entry a bit old now, but thanks for your code stefanbar, I needed the same thing for my code.
    I don’t really understand the use of this line:
    header(‘Content-type: application/json’);
    but it was necessary.

    #123123

    here’s a good tutorial that also uses the combination of PHP and AJAX, you can seach and the results are quick it also have limiters. http://www.upgradedtutorials.info/tutorials/fast-search-and-sorting-data-in-mysql-using-php-and-ajax/

Viewing 3 posts - 16 through 18 (of 18 total)
  • The forum ‘JavaScript’ is closed to new topics and replies.