jquery pagination problem  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | - <html>
-
<head>
-
<script src="jquery.js" type="text/javascript"></script>
-
<script src="jquery.rating.js" type="text/javascript" language="javascript"></script>
-
<link href="jquery.rating.css" type="text/css" rel="stylesheet"/>
-
<link rel="stylesheet" type="text/css" href="style.css">
-
-
<script type="text/javascript">
-
$(document).ready(function() {
-
$("#mobile_brand").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property3").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property4").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property6").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
});
-
</script>
-
-
</head>
-
<body>
i have a small prob. the jquery.rating.js does work when the page is loaded but when the filtering takes place with the further jquery statements the 1st jquery.rating.js which replaces all the checkboxes with the star symbol does not work it displays the checkbox as it it!! i dont know whts the prob.
| |
best answer - posted by acoder |
I've had a quick look at the code and I think I see where the problem might be. When you load the page, the code runs, so the page is updated, but when you make an update, you need to re-run the code to convert the radio buttons back to stars. Here's the code which you can try: - $('input[type=radio].star').rating();
|  | Needs Regular Fix | | Join Date: Mar 2008 Location: Chennai - India
Posts: 350
| | | re: jquery pagination problem
Hi,
Just place the file inclusion in the end of the body in your html... Like call the function after the page is loaded... This will do.
Thanks and Regards
Ramanan Kalirajan
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
what files !! i tried to keep the javascript files at end of body!!! but did not work!!!
|  | Needs Regular Fix | | Join Date: Mar 2008 Location: Chennai - India
Posts: 350
| | | re: jquery pagination problem
Hi, I dont have much knowledge on JQuery. I have worked in Prototype. Is there any Listener function or observer function for body load, if there just use that and place the script code inside that
Thanks and Regards
Ramanan Kalirajan
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
as u can see in the code -
<script type="text/javascript">
-
$(document).ready(function() {
-
$("#mobile_brand").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property3").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property4").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property6").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
});
-
</script>
-
is the code where ready body load is taken care of .
should i use the script code inside here or how?
|  | Needs Regular Fix | | Join Date: Mar 2008 Location: Chennai - India
Posts: 350
| | | re: jquery pagination problem
Can you please post the code for this "jquery.rating.js which replaces all the checkboxes with the star symbol". If possible attach the html files and Js Files.
Thanks and Regards
Ramanan Kalirajan
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
you can find the jquery.rating.js http://www.fyneworks.com/jquery/star.../#tab-Overview
i just name the checkbox class as star and it replaces it with star . if u still want ma code i will paste it.
|  | Needs Regular Fix | | Join Date: Mar 2008 Location: Chennai - India
Posts: 350
| | | re: jquery pagination problem
Post Your Code...
Thanks and Regards
Ramanan Kalirajan
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
this is a page called product_display.php - <?php
-
session_start();
-
include_once('db.php');
-
include_once('valid-scripts/validateData.php');
-
error_reporting (E_ALL & ~ E_NOTICE);
-
?>
-
<html>
-
<head>
-
<script src="jquery.js" type="text/javascript"></script>
-
<script src="jquery.rating.js" type="text/javascript" language="javascript"></script>
-
<link href="jquery.rating.css" type="text/css" rel="stylesheet"/>
-
<link rel="stylesheet" type="text/css" href="style.css">
-
-
<script type="text/javascript">
-
$(document).ready(function() {
-
$("#mobile_brand").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property3").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property4").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
$("#property6").change(function() {
-
$.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
$("#change").html(data);
-
});
-
});
-
});
-
</script>
-
-
</head>
-
<body>
-
<div id="layout">
-
<br/>
-
<?php include_once('menu.php'); ?>
-
<h2>Mobiles</h2>
-
<?php
-
$sql1="select distinct(property1) from mobiles";
-
$result1=mysql_query($sql1);
-
$myresult1 = "";
-
$myresult1 .= "<form name='' method='POST' action=''>";
-
$myresult1 .= "<select name='mobile_brand' id='mobile_brand'>";
-
$myresult1 .= "<option value=''>Mobile Brand</option";
-
while($row1=mysql_fetch_array($result1)){
-
$myresult1 .= "<option value='".$row1['property1']."'>".$row1['property1']."</option";
-
}
-
$myresult1 .= "</select> ";
-
-
$enumFields = getEnumFieldValues('mobiles', 'property4');
-
$myresult1 .= "<select name='property4' id='property4'>";
-
$myresult1 .= "<option value=''>Price</option";
-
foreach($enumFields as $value)
-
{
-
$myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
-
}
-
$myresult1 .= "</select> ";
-
-
-
$enumFields = getEnumFieldValues('mobiles', 'property3');
-
$myresult1 .= "<select name='property3'id='property3'>";
-
$myresult1 .= "<option value=''>Type</option";
-
foreach($enumFields as $value)
-
{
-
$myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
-
}
-
$myresult1 .= "</select> ";
-
-
$enumFields = getEnumFieldValues('mobiles', 'property6');
-
$myresult1 .= "<option value=''></option";
-
$myresult1 .= "<select name='property6' id='property6' >";
-
$myresult1 .= "<option value=''>Os</option";
-
foreach($enumFields as $value)
-
{
-
$myresult1 .= '<option value='.$value.'>'.str_replace("'","",$value).'</option>';
-
}
-
$myresult1 .= "</select>";
-
-
$myresult1 .= "</form>";
-
$myresult ='';
-
$myresult .="<div id='change'>";
-
$myresult .="<table width='100%'>";
-
$sql2 = "select * from mobile_master";
-
$result2 = mysql_query($sql2);
-
//$myresult .="<tr><td><b> </b></td>";
-
//$myresult .="<td><b>Description</b></td>";
-
//$myresult .="<td><b>Overall Rating</b></td>";
-
//$j = 1;
-
//while ($row2 = mysql_fetch_array($result2)){
-
//if($j <= 1){
-
//$myresult .="<td><b>".$row2['property1_name']."</b></td>";
-
//$myresult .="<td><b>".$row2['property2_name']."</b></td>";
-
//}
-
//$j++;
-
//}
-
$myresult .="</tr>";
-
-
$myresult .="<tr><td> </td><td> </td><td> </td></tr>";
-
$sql="select * from mobiles";
-
$result=mysql_query($sql);
-
$i=0;
-
while($row=mysql_fetch_array($result)){
-
$sqlr="select overall_rating from mobiles where property1='". $row['property1']."' and property2='". $row['property2']."'";
-
$resultr=mysql_query($sqlr);
-
$rating = mysql_fetch_array($resultr);
-
$myresult .="<tr><td><center>";
-
if($row['pic'] != ""){
-
$myresult .= "<a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='picdisplay.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'</img></a><br/>".$row['property1']." ". $row['property2'] ;
-
}
-
else
-
{
-
$myresult .= "<a href='mobile_rating.php?brand=". $row['property1'] . "&model=".$row['property2'] . "'><img src='images/no-image.gif' width='50' height='70'</img></a><br/>".$row['property1']." ". $row['property2'];
-
}
-
$myresult .="</center></td>";
-
-
/*if($row['description'] != ""){
-
$myresult .= "<td>" . $row['description']. "</td>";
-
}
-
else
-
{
-
$myresult .= "<td> </td>";
-
}*/
-
//if($rating['overall_rating'] != ""){
-
$i++;
-
$myresult .= "<td>";
-
for($k = 1; $k <= 10; $k++)
-
{
-
if($rating['overall_rating'] == $k)
-
{
-
$chk ="checked";
-
}
-
else
-
{
-
$chk = "";
-
}
-
$myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk title='". $k." out of 10 ' disabled/> ";
-
}
-
$myresult .= "</td>";
-
/*$myresult .= "<td>" . $rating['overall_rating']. "</td>";
-
}
-
else
-
{
-
$myresult .= "<td> </td>";
-
}*/
-
//$myresult .= "<td>" . $row['property1']. "</td>";
-
//$myresult .= "<td>" . $row['property2']. "</td>";
-
$myresult .="</tr>";
-
}
-
$myresult .="</table>";
-
$myresult .="</div>";
-
echo $myresult1;
-
echo "<br/>";
-
echo "<br/>";
-
echo $myresult;
-
?>
-
<br/>
-
</body>
-
</html>
and this is mobile_change.php |  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
i am using jquery something like this -
# <script type="text/javascript">
-
# $(document).ready(function() {
-
# $("#mobile_brand").change(function() {
-
# $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
# $("#change").html(data);
-
# });
-
# });
-
# $("#property3").change(function() {
-
# $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
# $("#change").html(data);
-
# });
-
# });
-
# $("#property4").change(function() {
-
# $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
# $("#change").html(data);
-
# });
-
# });
-
# $("#property6").change(function() {
-
# $.post("mobile_change.php",{ brand:$("#mobile_brand").val(),price:$("#property4").val(),type:$("#property3").val(),os:$("#property6").val() } ,function(data){
-
# $("#change").html(data);
-
# });
-
# });
-
# });
-
# </script>
-
#
to filter using the drop downs!!!! but when paginations of these filtered values the filtration is going off and it will show the all the values!! how to achieve pagination of filtered values?? or which is the best way to use jquery for this purpose!
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: jquery pagination problem
Haven't looked at your code in detail, but perhaps the problem lies in the fact that you're setting the element with ID "change" to include another element with ID "change".
PS. threads merged. Please do not double post.
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
the 1st problem was different from the second so posted it again with different name sorry .
so how exactly is the way to solve the problem .
my need is like .
there are 4 dropdowns depending on which the respective entries from DB must be selected . and pagination is also required ..
will jquery be helpful for this ?
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
i cld solve the pagination problem by using the form $_GET and stuff !! but the original problem which i posted 1st still remains!!can any one plz look at code and help me ??
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: jquery pagination problem
You have the following line:
This sets the element "change" to the response of the Ajax request to mobile-change.php.
In that PHP file, the response includes this line: - $myresult .="<div id='change'>";
which means multiple duplicate IDs. Either remove this line or make the ID unique.
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
oh okie!! i thought it will replace the element with ID change with the data in mobile_change.php ..... so added it ....
hey i checked the source code ...the ID "change" is there only 1 time after the jquery has also executed !
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
the exact problem is that the starts which are replacing the radio buttons in not appearing once the jquery is executed !! but when the 1st time page loads the starts are appearing !!! i just repeated my problem to be clear!
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: jquery pagination problem
I've had a quick look at the code and I think I see where the problem might be. When you load the page, the code runs, so the page is updated, but when you make an update, you need to re-run the code to convert the radio buttons back to stars. Here's the code which you can try: - $('input[type=radio].star').rating();
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
okie that piece of code worked ... i need a small help ...i am trying to display the value when he/she clicks on the stars . but the onclick is not working .
the webisite had given some code to alert the star rate - $('.auto-submit-star').rating({
-
callback: function(value, link){
-
alert(value);
-
}
-
});
but its not working .. help on this !
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: jquery pagination problem
That's probably because '.auto-submit-star' should be '.star'
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
nope i replaced it with star only !!! the stars are appearing but when i click on any star the the alert is not coming
i just modified the code like - <script>
-
$(function(){
-
$('input[type=radio].star').rating({
-
callback: function(value, link){
-
alert("yes");
-
}
-
});
-
});</script>
-
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
the entire (small piece concerning it ) -
<script>
-
$(function(){
-
$('input[type=radio].star').rating({
-
callback: function(value, link){
-
alert("yes");
-
}
-
});
-
});</script>
-
-
<?php
-
for ($i = 1 ; $i < $count; $i++){
-
if($row2['rating'.$i.'_name']){
-
$myresult .= "<tr><td>";
-
$indfeature = 0;
-
$indfeature = getindividualrating(rating.$i,$brand,$model);
-
$myresult .= $row2['rating'.$i.'_name']." (".round($indfeature) .")<br/><br/>";
-
$myresult .= "</td>";
-
$myresult .= "<td>";
-
$myresult .= "<div class='Clear'>";
-
if($user != "")
-
{
-
$tocheck = $ratingchk[$i];
-
}
-
else
-
{
-
$tocheck = round($indfeature);
-
}
-
for($k = 1; $k <= 10; $k++){
-
if($tocheck == $k){
-
$chk = "checked";
-
}
-
else
-
{
-
$chk = "";
-
}
-
$myresult .= "<input class='star' type='radio' name='rating".$i."' id='rating".$i."' value='". $k ."' $chk $disabled title='". $k." out of 10 ' onclick=\" return sayvalue(this);\"/> ";
-
}
-
$myresult .= "<span id='current-rating".$i."'> </span>";
-
$myresult .= "</div>";
-
$myresult .= "</td>";
-
$myresult .= "</tr>";
-
}
-
}
-
-
|  | Needs Regular Fix | | Join Date: Jul 2007 Location: India
Posts: 407
| | | re: jquery pagination problem
is there something wrong in code that i need to change ?
|  | Site Moderator | | Join Date: Nov 2006 Location: UK
Posts: 14,581
| | | re: jquery pagination problem
Can you post a link to a test page? If not, post the HTML code.
|  | Similar JavaScript / Ajax / DHTML bytes | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 226,533 network members.
|