loacation.href and form verify problem

19 views
Skip to first unread message

couleurs AFRIK

unread,
Nov 6, 2016, 9:34:59 AM11/6/16
to phonegap
Hi
i have some problem on my  cordova login system
first a redirect problem, in case of success the redirection does  always comes on the login page it does not redirect to the specified page.
the secondary the control of the form is not work, it not verify the form before to send.

<script>
        $
(document).ready(function() {  
        $
(".anim").hide();
        $
("#login").click(function() {
   
       
var email = $("#UserUsername").val();
       
var pass = $("#UserPassword").val();
         
if(email!='' || pass !=''){
           alert
(email);
           $
(".anim").show();
           $
.ajax({
                    url
:'website/api/users/loginApi/',
                   
//header: {'Access-Control-Allow-Origin':'*'},
                    crossDomain
: true,
                    async
: false,
                    data
:$("#Userformlogin").serialize(),
                    dataType
: 'json',
                    type
: 'Post',
                    success
: function(data) {
                        alert
(JSON.stringify(data));
                       
//alert(data.status);
                       
if(data.status=='success'){
                           
if(data.Userrole='jobbeur'){
                            alert
(data.Msg);
                            location
.href ="besoin.html";
                           
}else if(data.Userrole='jobmaker'){
                            alert
(data.Msg);
                            location
.href ='besoin.html';
                           
}else{
                            window
.location.replace('dashboard.html');
                           
}
                       
}else{
                          window
.open('login.html');
                          $
("#msg").append(data.Msg);
                          document
.getElementById("msg").innerHTML=data.Msg;
                       
}
                             
                   
},
                    error
: function(xhr, status, err) {
                        alert
('no loggin');
                        alert
(err);
                   
}
             
});
         
}else{
            location
.href ='besoin.html';
       
}
       
});
     
               
});

   
</script>

Please I made a mistake somewhere in my code?
Thanks.


Kerri Shotts

unread,
Nov 9, 2016, 7:44:47 AM11/9/16
to phonegap
First places to check:
 - Your whitelist configuration in config.xml
 - Your Content Security Policy meta tag (index.html in your <head> tag).

It might be helpful to see both (minus secret/identifying information).

On Sunday, November 6, 2016 at 8:34:59 AM UTC-6, couleurs AFRIK wrote:

Reply all
Reply to author
Forward
0 new messages