Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 05-16-2012, 02:20 PM   PM User | #1
confused45
New to the CF scene

 
Join Date: May 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
confused45 is an unknown quantity at this point
Small piece of code..is this possible?

I have a piece of code that pulls reviews and allows a business owner to drop the reviews on to their website. I need to limit the number of reviews and ideally I'd like to do that with just the snippet the biz owner drops into their site. Is this possible? Here's a sample of the code:

<div id="repagent_reviews"></div><script type="text/javascript" src="http://awebsite.com/anotherwebsite/wp-admin/admin-ajax.php?action=repagent_reviews_js&id=1182"></script>


thanks!

confused
confused45 is offline   Reply With Quote
Old 05-16-2012, 04:07 PM   PM User | #2
confused45
New to the CF scene

 
Join Date: May 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
confused45 is an unknown quantity at this point
Anybody have a thought on this?
confused45 is offline   Reply With Quote
Old 05-16-2012, 04:27 PM   PM User | #3
Philip M
Supreme Master coder!

 
Philip M's Avatar
 
Join Date: Jun 2002
Location: London, England
Posts: 17,033
Thanks: 197
Thanked 2,410 Times in 2,388 Posts
Philip M has a spectacular aura aboutPhilip M has a spectacular aura aboutPhilip M has a spectacular aura about
Please have a look at forum guideline 5. It's ok to occasionally bump a thread, but only when done after an ample amount of time (ie: 2-3 days) have passed without a response, and never more than once. You have bumped after less than 2 hours - we are not standing around here 24/7 to answer your questions.

If you want to limit the number of reviews you will need to use server-side coding.
__________________

All the code given in this post has been tested and is intended to address the question asked.
Unless stated otherwise it is not just a demonstration.
Philip M is online now   Reply With Quote
Old 05-16-2012, 04:36 PM   PM User | #4
confused45
New to the CF scene

 
Join Date: May 2012
Posts: 3
Thanks: 0
Thanked 0 Times in 0 Posts
confused45 is an unknown quantity at this point
Apologies for that. I must have missed that when perusing the guidelines.


On your response. Pretend I don't know what that means. Can you elaborate?
confused45 is offline   Reply With Quote
Old 05-16-2012, 08:09 PM   PM User | #5
Old Pedant
Supreme Master coder!

 
Old Pedant's Avatar
 
Join Date: Feb 2009
Posts: 23,168
Thanks: 59
Thanked 3,993 Times in 3,962 Posts
Old Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to allOld Pedant is a name known to all
That means that the code on this page:
Code:
http://awebsite.com/anotherwebsite/wp-admin/admin-ajax.php
should do the limiting.

Possibly you could pass another parameter specifying how many reviews you want and then the PHP code can limit them. If the PHP code is pulling the reviews from a database, then the PHP code would simply pass the limit along to the SQL query that gets the data.

Example:
Code:
http://awebsite.com/anotherwebsite/wp-admin/admin-ajax.php?action=repagent_reviews_js&id=1182&count=5
__________________
An optimist sees the glass as half full.
A pessimist sees the glass as half empty.
A realist drinks it no matter how much there is.
Old Pedant is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 02:51 PM.


Advertisement
Log in to turn off these ads.