I have seen posts with similar topics, but not with exactly the same errors I am getting, so apologies if it's been answered somewhere else!!
I have a popup window which has 2 questions for the user in order to initiate a new listing in the database. What should happen is that on "submit", the window closes, the new listing is created and the user is redirected to the main edit_listing page. However, what is happening, is that although the database is being populated with the details in the background on "submit", the popup window is not closing and there is no redirection.
This is the same for IE, Chrome and Firefox.
<script type="text/javascript">
$("#add_listing_form_button").click(function(){
$("#add_listing_form").submit();
});
$("#add_listing_form").validate({
meta: "validate",
submitHandler: function(form) {
$("#add_listing_form_button").attr("disabled", "true");
$.post("{baseurl}/admin/ajax.php?action=ajax_add_listing", $("#add_listing_form").serialize(),
function(data){
if(data.error == "1")
{
$("#add_listing_form_button").attr("disabled", "false");
alert(data.error_msg);
}
else
{
var listing_id = data.listing_id;
$("#add_listing_form_button").attr("disabled", "false");
$.fn.colorbox.close();
window.location = "{baseurl}/admin/index.php?action=edit_listing&edit="+listing_id;
}
}
,"json");
return false;
}
});
</script>
I have done a similar thing for adding a new user successfully and can't seem to figure out what is creating the error - It's likely a missing character somewhere and could do with another set of eyes on it!!
If I have missed anything please let me know - I'd like to say that this isn't my day job, so be gentle!!
Many thanks
Gavin
MOD EDIT: Added code tags. When posting code...USE CODE TAGS!!!
This post has been edited by JackOfAllTrades: 25 December 2012 - 04:56 AM

New Topic/Question
Reply


MultiQuote



|