Save and add another function in php
Posted: Wed Dec 04, 2013 2:30 pm
Currently what we have is a html form in customerproblem.php, when the customer fills the form and click save it will be directed to saveproblem.php where the problem will be assigned to concerned department and once it is assigned it will be redirected to home page. So what we need now is one new button called "save and add another" in customerproblem.php which when click will save the form info and reset the form to allow users to add new info, without redirecting to saveproblem.php. And finally when customer click save button, all the added information will be appended in text field that is in saveproblem.php.
What I tried was:
frmAdd has this code (there are other codes as well)
<input type="button" value="Save and add another" onclick="save()"
and i call a function save on click
function save(){
$.ajax({
type: "POST",
url: "saveproblem.php,
data: jQuery("#frmAdd").serialize(),
cache: false,
success: function(data){
alert("Savings has been updated successfully.");
window.location.reload(true); }
});
}
What I tried was:
frmAdd has this code (there are other codes as well)
<input type="button" value="Save and add another" onclick="save()"
and i call a function save on click
function save(){
$.ajax({
type: "POST",
url: "saveproblem.php,
data: jQuery("#frmAdd").serialize(),
cache: false,
success: function(data){
alert("Savings has been updated successfully.");
window.location.reload(true); }
});
}