Link to home
Start Free TrialLog in
Avatar of ussher
ussherFlag for Japan

asked on

javascript call url without page refresh

my rating system is set up so that when i click on one of the stars the page refreshes.  I would like the same links to be used, but for the page not to refresh.

is there any way to do this using the current code?

The current code uses html links that return the user to the current page.  instead of refreshing the page, i would like the link to be opened in  a div so that the music in the player on the page does not start from the beginning again.

the stars are supposed to rate the song, but rating the song causes the song to stop.  not ideal.

<ul class="star-rating">
<li style="width: 0%;" class="current-rating"/>
<li><a class="star1-rating" title="1" href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=1"/></li>
<li><a class="star2-rating" title="2" href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=2"/></li>
<li><a class="star3-rating" title="3" href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=3"/></li>
<li><a class="star4-rating" title="4" href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=4"/></li>
<li><a class="star5-rating" title="5" href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=5"/></li>
</ul>

Open in new window

ASKER CERTIFIED SOLUTION
Avatar of scrathcyboy
scrathcyboy
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Michel Plungjan
You mean


A href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=1" target="content"> first star </A>
A href="hxxp://mysite.com/rating.php?mode=update_rating&amp;band_id=2&amp;type=band&amp;refresh=1&amp;rate_num=2" target="content"> second star </A>

or just put the complete rating html in the iframe.
Avatar of ussher

ASKER

Thanks for the suggestions.

Im trying to get it to work, but because an iframe loads content that is on another page, and the code that makes it go is generated by a function call its not so easy.

why, because to have the other iframe load another page, i first have to set up that page to have access to the function that created the code in the first place.

so, im trying.  its a good idea.  thanks.
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
"because an iframe loads content that is on another page, and the code that makes it go is generated by a function call its not so easy."

<A href="star1.html" target="iframe_name"> first star </A>

What could be easier than that?  It is the TARGET spec that sends the page into the iframe, it is SO easy.



Avatar of ussher

ASKER

The star rating system is generated by a smarty function.
The logic of behind the creation of the function is not mine and updates are received so i cant change the logic.
The page after the rating button is clicked contains music that starts automatically. (so opening it in an iframe could result in 2 songs playing, where the purpose is to smoothly continue listening.)

Thats the stuff that makes it difficult.

Thanks for your help, both solutions are correct answers to my question, even if my ability to implement them is a bit lacking.
Avatar of ussher

ASKER

Thanks.