![]() |
Specifying variable in parent to match ajax result variable
Ok, so I've built a member search using ajax to change the results each time a filter is changed. It works great, except one minor issue that I'm struggling with...
Each result has a link under their image to add that person as a friend, when you click it I use colorbox to pop up a modal window with that user's information and a submit button to fire the add as friend function. I can get the modal window to fire and be populated with the proper information for each individual result. The problem is I have to load the script in the parent file and the way this works is you specify a div id for the link class to load when you load the script. So as an example in your script you specify link class "linkclass" opens "linkclasscontent". The way I'm setting this up in the ajax file to get this to populate the proper data is matching the linkclasscontent to the member id by doing id="linkclasscontent$id" which seems to do the trick fine, I just can't specify dynamically in the parent file that linkclass$id opens linkclasscontent$id as I don't know of any way to pass that $id variable back over to the parent. Here's the actual code I'm using: Parent File Script: Code:
<script type="text/javascript" src="js/jquery-1.5.1.min.js"></script>Code:
<style type="text/css"> |
Ok, as an interim fix I went ahead and set up an $i=1 and changed it from depending on the user id to use the $i number. The problem I have with this is I have to specify a specific new line for each result. Currently I have 40 different lines, it's bloated and sloppy in my opinion, there has to be a better way to do this.
|
One other issue with this, it seems I have to click twice on the link to get it to fire the modal window. I'm guessing it's a focus thing but I can't seem to get around this.
|
I got around the double click thing by adding the colorbox code to the end of the ajax script so it's reinitiated each time.
|
| All times are GMT +1. The time now is 12:30 PM. |
Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.