Im trying to post some data to backend at regular intervals based on the data submitted by the user.
app\design\frontend\base\default\template\vendor_recipe\recipe_creation\index.php
<!DOCTYPE html>
<html>
<head>
<!--<link class="jsbin" href="http://ajax.googleapis.com/ajax/libs/jqueryui/1/themes/base/jquery-ui.css" rel="stylesheet" type="text/css" />-->
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"></script>
<script class="jsbin" src="http://ajax.googleapis.com/ajax/libs/jqueryui/1.8.0/jquery-ui.min.js"></script>
<script>jQuery.noConflict();</script>
<meta charset=utf-8 />
<title>JS Bin</title>
<!--[if IE]>
<script src="http://html5shiv.googlecode.com/svn/trunk/html5.js"></script>
<![endif]-->
<style>
article, aside, figure, footer, header, hgroup,
menu, nav, section { display: block; }
</style>
</head>
<body>
<div class="main">
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>
<script>jQuery.noConflict();</script>
<script>
$(document).ready(function() {
timePicker(10);
});
</script>
<script>
// timer code starts here ---
//var init2 = 50;
var s;
function timePicker(vr) {
if (vr > 0)
{
if (vr > 1) {
$('#timer').html('');
} else {
$('#timer').html('');
}
vr--;
s = setTimeout('timePicker(' + vr + ')', 1000);
} else {
clearInterval(s);
$.post('data.php',{txt_area:$('#rec_name').val(),txt_title:$('#rec_title').val()},function(r){
$('#upd_div').html("Last Updated: "+r);
$('#timer').html('Recipe Contents Saved.. ');
s = setTimeout('timePicker(' + 10 + ')', 5000);
return false;
});
}
}
function readURL(input) { //function for Recipe Photo upload image
if (input.files && input.files[0]) {
var reader = new FileReader();
reader.onload = function (e) {
$('#blah')
.attr('src', e.target.result)
.width(150)
.height(200);
};
reader.readAsDataURL(input.files[0]);
}
}
</script>
<div>
<other text fields> //All these fields to be saved to backend at given time interval
<!--Updated at timer control -->
<!--I get only x Secs as output.-->
<br/><br/>
<div id="timer_upd_dev">
<div id="timer">x Secs </div>
<div id="upd_div"> </div>
</div>
<br/><br/>
</div>
<div class="form-group2">
<div class="rec_name">
<label>Recipe Name:</label>
<input type="text" name="rec_name" id="rec_name" class="form-group2" />
</div>
<br/><br/>
<div class="rec_title">
<label>Recipe title:</label>
<input type="text" name="rec_title" id="rec_title" class="form-group2" />
</div>
<br/><br/>
</div>
Here, in the timePicker function , im posting my values to another page in the same folder, data.php
If the try the run the whole folder from /var/www/html, data is posting to data.php and also values get saved to backend.
in data.php , im saving the values posted from txt_area and txt_title
But why do i get this when i place both indexphtml and data.php inside the magento environment and run.