0

I want something like when you click on image on facebook, url changes to facebook.com/photo.php?.... but without redirect. I want exactly the same thing but to open the messages, not photos. Simply, i want when user clicks on displayed messages with other users to open a new popup window without redirecting to new page with all messages with that user. Is that possible and if it is please tell me how to do that.

Example:
Messages with user A
Messages with user B
Messages with user C

And when user clicks on 'Messages with user B', it will open new popup window with all messages with that user, and of course, pulled from database.

valek
  • 1,365
  • 16
  • 27
  • This is too broad. What are you stuck with? Can you narrow it down to a specific issue? – Pekka Jan 05 '14 at 22:35
  • No, i can't because i'm new in PHP and i didn't even start to write the code beacuse actually i don't know how to start it so i just want to know is that possible and if it is, what is the simpliest way to do that...I don't want the whole code pasted here, i wan't to try myself but i really don't know how... – valek Jan 05 '14 at 22:39
  • 2
    This may get you started: http://jqueryui.com/dialog/ – Pekka Jan 05 '14 at 22:46
  • Thank you, but how to display all messages between 2 users when you click on 'Messages with user B'...How to get messages from database in moment when that button/div is clicked? – valek Jan 05 '14 at 22:49
  • 1
    The technique used to get updates from the server without reloading the page is called Ajax. jQuery has a very convenient implementation: http://api.jquery.com/jquery.ajax/ – Pekka Jan 05 '14 at 22:49
  • Thank you, i thought that i must do that with ajax. That helped me, thanks... – valek Jan 05 '14 at 22:51

2 Answers2

1

I think I understand what you are looking for!

Use case scenario:

1- User looks at a feed of posts/images/anything. 2- User clicks on one of those posts and, it opens in a box with that same content.

The thing you are looking for is called "Lightbox" or "FancyBox".

I googled and found a few examples: http://fancyapps.com/fancybox/ http://www.no-margin-for-errors.com/projects/prettyphoto-jquery-lightbox-clone/

http://lokeshdhakar.com/projects/lightbox/

you basically need to recreate the loop or make on a onclick function when user chooses the photo, and just call the index of that photo again inside the lightbox.

0bserver07
  • 3,390
  • 1
  • 28
  • 56
1

I decided to write this as an answer since it is too long for a comment.

To "properly" set up what you want, you need several parts working together:

  • AJAX: (eg: jQuery.ajax) Retrieve data from the server programmatically with javascript
  • CSS/HTML dialog: (eg: jQueryUI dialog) Create a fake popup inside your page, usually to give the content some prominence
  • History State: (eg: SO Q/A) Change the page URL (in addressbar) without reloading the page.
Community
  • 1
  • 1
Christian
  • 27,509
  • 17
  • 111
  • 155