Guest  

Welcome Guest, posting in this forum requires registration.

Pages: [1]
Topic: How to refresh only 10 times? Please resolve this problem.
Guest
Member
Posts: 14

Reputation: 21
How to refresh only 10 times random number? Please resolve this problem.
on: May 18, 2016, 11:13

<ul>
<input type="hidden" id="athid_user" name="data[Number][user_id]" value="<?php echo $loggeduser['User']['id']; ?>" />
<?php $countno = $loggeduser['User']['myproducts']; ?>
<span>
<li class="cncnct">
<div id="div1-wrapper">
<?php $frt = rand(); ?>
<div id="selfirst">
<input type="hidden" name="data[Number][selectnumber]" id="check_backgrnd" value="<?php echo $frt; ?>" required>
<?php $b = '';
$nubmer = $frt;
$arr = str_split($nubmer, 2);
echo implode(" ", $arr);
pr($b);
?>
</div>

</div>
<a href="javascript:void(0);" id="refresh_first">
<img src="<?php echo $this->webroot;?>front/images/refresh_image.png" title="Refresh" alt="Refresh">
</a>
<script>
$('#refresh_first').on('click',function(){
//var count = parseInt($("#check_backgrnd").val());
//if(count < 10){
var url = '<?php echo $this->Html->url("/users/dashboard");?>';
//console.log(url);
$('#div1-wrapper').load(url + ' #selfirst');
// count=count+1;
//$("#check_backgrnd").val(count);
// }else{
///alert("Limit Exceed");
//}
});
</script>
</li>
</span>

</ul>

Guest
Member
Posts: 61

Reputation: 105
Re: How to refresh only 10 times? Please resolve this problem.
on: May 18, 2016, 12:05

<ul>
<input type="hidden" id="athid_user" name="data[Number][user_id]" value="2" />
<?php $countno = 10; ?>
<span>
<li class="cncnct">
<div id="div1-wrapper">
<div id="selfirst">
<span id="test"></span>
<input type="hidden" id="rndm" name="random_number"/>
<input type="number" name="count" id="count" value="1" style="display:none;" required>
</div>

</div>
<input id="btn" type="button" value="Refresh" />
<input id="reset" type="button" value="Reset" />
</li>
</span>
</ul>
<script type="text/javascript">
$(document).ready(function(){
$("#count").val('1');
function random_number(){
$("#test").html("");
// var randm="";
for(var i =1; i<=5;i++){
var num = Math.floor(Math.random() * 90) + 10;
var html = $("#test").html();
html = html + " "+num;
var test =$("#test").html(html);
// randm = html+num;
}
var rndm = $("#test").html();
rndm =rndm.replace(/ /g,'');
$("#rndm").val(rndm);
console.log(rndm.replace(/ /g,''));
//.replace(/ /g,'')
}
random_number();
$('#btn').on('click',function(){
var count = parseInt($("#count").val());
console.log(count);
if(count < 10){
random_number();
count=count+1;
$("#count").val(count);
}else{
alert("Limit Exceed");
}
});
$('#reset').on('click',function(){
$("#count").val('1');
alert("Click on refresh button to check the functionality again");
})
})

</script>

Guest
Member
Posts: 14

Reputation: 21
Re: How to refresh only 10 times? Please resolve this problem.
on: May 18, 2016, 18:12

Very very Thanks .Its working fine.

Pages: [1]
WP Forum Server by ForumPress | Lucid Crew
Version: 1.8.2 ; Page loaded in: 0.02 seconds.

Share This: