skip to Main Content

I have reached a point in my project where I cannot figure out how to use Ajax to keep going. I am new to using it, but I’d like to think that I have a basic understanding of how it works.

I run a site where I take form data and post it into a database, then send it to a webpage where it displays in bubbles. Users can then click these bubbles and pop open a modal which has more detailed information than what is presented in the small bubbles initially displayed.

I’ve hit a wall where I don’t know how to open a modal and have it live update with new information without closing, no matter what the bubble they click is (which can have different types based on different form information sent).

And to be clear, by bubble I just mean a compact div that when clicked opens the modal.

I’ve looked everywhere for solutions to this, trying my best to apply knowledge from other projects to what I’m trying to accomplish with to no avail. Suggestions are appreciated!

2

Answers


  1. I’d suggest you to look at the load method this should be enough for what you’re trying to do.

    Login or Signup to reply.
  2. If you want a live update of your modal you have two ways to go about this:

    1. Implement polling in AJAX. Send an AJAX request every X seconds to the server and have it update the <div>‘s in your modal.
    2. Use WebSockets. This is far more complex, and solution 1. is probably good enough.

    This Stack Overflow post should help get you started: jQuery, simple polling example

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search