Closed Thread
Results 1 to 5 of 5

Thread: Modal Windows - Javascript/Jquery

  1. #1
    Member WebWatcher is an unknown quantity at this point
    Join Date
    Jan 2006
    Posts
    49

    Modal Windows - Javascript/Jquery

    Is there a way you can transfer data when a user clicks on a modal window link and it opens up?

    Any help would be appreciated

    Thanks

  2. #2
    WP Like sander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to beholdsander k is a splendid one to behold sander k's Avatar
    Join Date
    Jan 2008
    Location
    Netherlands
    Posts
    2,233
    What kind of data?
    Opening soon WP Like!

  3. #3
    Pro Member TehGuy is just really niceTehGuy is just really niceTehGuy is just really niceTehGuy is just really niceTehGuy is just really nice TehGuy's Avatar
    Join Date
    Nov 2003
    Location
    Arkansas, United States
    Posts
    275
    Yup, but you gotta be a little more specific. Did you make your own modal solution, or are you using jQuery UIs?

    What do you mean by transfer data? Loading content on the modal only when it's clicked? POSTing or GETing data to another page?

  4. #4
    Junior Member SitesTen is an unknown quantity at this point
    Join Date
    Aug 2012
    Posts
    11
    If you want to transfer data on the background without the page to be refreshed, you need to use AJAX calls. Data can be serialized as JSON object. You have to search the Internet about more information on those two topics as it cannot be explained that easily in a single post.

  5. #5
    Pro Member TehGuy is just really niceTehGuy is just really niceTehGuy is just really niceTehGuy is just really niceTehGuy is just really nice TehGuy's Avatar
    Join Date
    Nov 2003
    Location
    Arkansas, United States
    Posts
    275
    Easy enough to show how it works in one post, but you're right, it's tough to explain all the concepts all at once. There's a lot involved for the whole process, even if it boils down to ~10 lines of code. You need some knowledge of html/css, javascript/jQuery, a server-side scripting language, and JSON. I don't know what type of experience WebWatcher has with each of these, but here's an example that goes through the whole thing:

    http://jsfiddle.net/pr4bB/2/

    So, given a javascript object, you can encode the object into a JSON string. You can then send the JSON string to a server-side script of yours, process it however you want, and send a response back to your page.

    In the example I posted, here's what happens:

    1. A generic javascript object is created.
    2. A JSON string is generated for the object using a jQuery add-on (http://code.google.com/p/jquery-json/).
    3. When the user clicks the button, the JSON string is POSTed to a server-side script.
    4. A response is given (in this case, the script doesn't return anything).
    5. A modal window is created (using jQuery UI), and the response from the script is appended.



    And if you're just loading content from another page, it's even easier:

    http://jsfiddle.net/xGaZL/2/

    jsfiddle doesn't really have any pages that work for loading, so you just have to pretend the modal has content from another page haha)
    Last edited by TehGuy; August 9th, 2012 at 23:38.

Closed Thread

Similar Threads

  1. JQuery UI, Sortable (Serialize)
    By JonnyH in forum Programming Help
    Replies: 0
    Last Post: February 7th, 2009, 06:51
  2. JQuery
    By stuffradio in forum Programming Help
    Replies: 4
    Last Post: April 17th, 2008, 01:00
  3. Javascript help
    By BananaMaster in forum Programming Help
    Replies: 2
    Last Post: October 12th, 2007, 14:11
  4. Javascript?
    By Resshin in forum Programming Help
    Replies: 2
    Last Post: May 12th, 2002, 20:49
  5. Javascript
    By cheatpark in forum Programming Help
    Replies: 2
    Last Post: August 9th, 2001, 06:41

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