Hi,
I am using below code to post form data to MySQL.. It's all working fine except the redirect after post success. I don't get any error in the console and data are being submitted successfully as I have see in MySQL but the redirect is not happening so it will just stay on the same page.
Where is the problem? with thanks...
- <script type="text/javascript">
- $(document).ready(function()
- {
- // $(function() { $("#btnSave").button(); });
- // $(function() { $("#btnCancel").button(); });
- $("#btnSave, #btnCancel").button();
-
- $("#frmLeave").validate({
- invalidHandler: function()
- {
- $.fn.speedoPopup(
- {
- width: 300,
- height: 100,
- loadingImage: true,
- close: true,
- draggable: false,
- caption: "Error",
- htmlContent: "<b>Please fill all required fields!</b>"
- // htmlContent: validator.errorList[0].message
- });
- },
- rules:
- {
- cboCategory:
- {
- required: true
- },
- dateFrom:
- {
- required: true
- },
- dateTo:
- {
- required: true
- }
- },
- submitHandler: function (form)
- {
- $("#imgLoader").show();
- $("#lblLoader").show();
- $("#btnSave").hide();
- $("#btnCancel").hide();
- $("#btnSave").attr("disabled", true);
- // $(form).submit();
-
- $.ajax({
- type: 'POST',
- url: "submit_leave.php",
- dataType: "json",
- data: $('#frmLeave').serialize(),
- success: function()
- {
- window.location.href = '<?php echo $_SESSION["bluefile_domain_name"]; ?>my';
- }
- });
-
- // $(form).ajaxSubmit();
- // return false;
- }
- });
-
- $('#btnCancel').click(function() { window.location = '<?php echo $_SESSION["bluefile_domain_name"]; ?>my'; });
- });
- </script>