I'm using jQuery with the validation plugin when I submit a form:
$('.frmProject:visible').validate( {
errorContainer: ".site_details:visible .messageBox1",
errorLabelContainer: ".site_details:visible .messageBox1 span.messagehere",
invalidHandler: function(form, validator) {
},
rules: {
site_id: {
required: true,
}
},
messages: {
site_id: "Project has no assigned site information. Click the marker on the map at left to specify the site where this project took place."
},
submitHandler: function(data) {
SaveProject();
}
});
In the submitHandler,
function SaveProject(){
//... load variables with input contents
$.ajax({
url: 'ajax/save_project.php',
dataType: 'json',
data: 'id='+id+'&title='+title+'&project='+project+'§or='+sector+'&volunteer='+volunteer+'&lat='+lat+'&lng='+lng+'&name='+name+'&mun='+mun+'&prov='+prov,
success: function(data) {
//... load 'messages' object with stuff
$.each(messages, function(key, value) {
if (confirm(key)){
console.log(item);
}
});
}
});
}
When I submit the validated form and it gets to the confirm inside the each loop, I get the error message: "confirm is not a function".
How can I present a message to the user for confirmation?
Edit:
When I type "confirm" into the console I get this:
Inspecting in DOM reveals:
window > confirm() There are no properties to show for this object.
Inspecting in Script takes me to a place in jquery-1.6.2.min.js