Ok,Quick question for you jquery pros ...I have the following ... trying to use jquery shortcuts within regular javascript ...function showReviews(mid){ $('#detaildiv').html(jQuery.get('scripts/getreviews.php?mid='+ mid));}So ... just trying to fill a div after clicking on a row in a table ex: <tr onclick="showReviews(10)" >yadayada</tr>I just get $ is not a function ... so I figure I have to tell it to look at jquery ... but I am just not that familiar with how you have to tie this all together and properly initialize this.
8/6/2010 12:31:11 AM
you have to load jQuery somehow, like by putting it in a script tag before you use any of the shortcuts
8/6/2010 12:43:13 AM
http://docs.jquery.com/Using_jQuery_with_Other_Libraries
8/6/2010 9:02:26 AM
Ok, so I got it all initialized, and the .get shortcut is grabbing the contents from the script, as I wanted it to do...However, its not setting the contents of the "detaildiv" div ...I can see the div, as I have placed it with set height and width and background color for positioning/layout purposes, but no contents are being written to it at all.function showReviews(mid){ contents = jQuery.get('scripts/getreviews.php?mid='+ mid); jQuery('#detaildiv').html(contents);}
8/6/2010 10:06:09 AM
You're fucking up trying to set the HTML content of #detaildiv to the return value of the $.get. Read the documentation. Use a callback function on the $.get that sets the HTML content of #detaildiv to the the data returned.
function showReviews(mid) { $.get('scripts/getreviews.php?mid=' + mid, function(data) { $('#detaildiv').html(data); });}
8/6/2010 10:09:19 AM
ahh shit ... you're right ... thanks -function showReviews(mid){ contents = jQuery.get('scripts/getreviews.php?mid='+ mid, function(data) { $('#detaildiv').html(data); });}[Edited on August 6, 2010 at 10:14 AM. Reason : .]
8/6/2010 10:10:40 AM
No sweat. What are you working on?
8/6/2010 10:11:42 AM
I built this Event data management system, which ties in to an iPhone app.Its focused for State Fair organizations right now, and Indiana State Fair (which starts today) and NC State Fair are my first 2 clients.They wanted to be able to see all the location listings and manage the reviews/ratings (filter out any that looked like trash or used profanity) ... so I created a table view on the left, and want to use this to populate the list of reviews on the right hand side when they click on an individual row in the table.Then, from there, they can delete any abusive reviews.[Edited on August 6, 2010 at 10:17 AM. Reason : .]
8/6/2010 10:17:39 AM
This bit you posted when you edited:
function showReviews(mid){ contents = jQuery.get('scripts/getreviews.php?mid='+ mid, function(data) { $('#detaildiv').html(data); });}
8/6/2010 10:21:20 AM
its called when the user clicks on the row of the table, each row using a different mid in the function.Its working now with the above script ... html content is showing up in the div correctly.
8/6/2010 10:35:37 AM