why it's not redirecting?
Hi,
I am using the code below to sign in user with ajax and it's working fine when I just user window.location in the success but when I tried to give a condition to check the querystring ["redirect"] it will just stop on the loading animation and do noting.
what's wrong with this code please?
- $(document).ready(function(){
- $(function() { $( "#btnSignin" ).button(); });
- $('#btnSignin').click(function()
- {
- $('#waiting').show();
- $('#frmLogin').hide();
- $.ajax
- ({
- type : 'POST',
- url : '<?php echo $_SESSION["domain_name"]; ?>loginmember',
- dataType : 'json',
- data: { email : $('#txtEmailAddress').val(), pwd : $('#txtPassword').val() },
- success : function(data)
- {
- if (data.error === true)
- $('#waiting').hide();
- // $('#frmLogin').show();
- if (_GET['redirect']) { window.location = '<?php echo $_SESSION["domain_name"]; ?>biz'; }
- else { window.location = '<?php echo $_SESSION["domain_name"]; ?>memberhome'; }
- },
- error : function(XMLHttpRequest, textStatus, errorThrown)
- {
- $('#waiting').hide();
- $('#frmLogin').show();
- }
- });
- return false;
- });
- });