so i have this code i am working on(this is a dumbed down version of it)
Code:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html>
<head>
<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.6.1/jquery.min.js"></script>
<script type="text/javascript">
$(function(){
$("#Submit").click(function(){
for (i=0;i<=50;i++)
{
$.ajax({
url:"process.php",
type:"get",
data:$("form").serialize(),
success:function(response){
var obj = jQuery.parseJSON( response );
var success = obj.success;
var actionsNumber = obj.number;
$("#result").html('There have been '+actionsNumber+' loops completed');
}
})
}
})
})
</script>
</head>
<body>
<form action="" method="post">
<p>
<label><strong>Number of Loops</label>
</p>
<input name="count" type="text" value = "1"/>
</p>
<p>
<input id="Submit" type = "button" value = "Send">
</p>
</form>
<p id="result">There have been 0 loops completed</p>
</body></html>
so you see this for loop
for (i=0;i<=50;i++)
I want it to be able to be like
for (i=0;i<=count;i++)
so that it will loop the number of times inputted
also(though i dont know if this is something that i need to use js for) On my full code there are other textboxes that need to be sent to process.php each time that it is run.
How can i achieve this?
also before anyone asks i have googled this and searched around yet i havent been able to figure this out, everything i have tried hasnt worked
and here is the process.php
PHP Code:
<?php session_start();
// process the form data here
//:::::::::
//
if(!isset($_SESSION['number'])){
$_SESSION['number'] = 0;
}
$number = $_SESSION['number']++;
// output json response
echo'{"success":"true","number":"'.$number.'"}';
?>