I have a small javascript function and I am using ajax on it.
     function checklogin() {
     var unp = $("#input-36").val();
     var pwp = $("#input-35").val();
     $.ajax({
         url: '<?php echo site_url()."/login/main"?>',
         type: 'post',
         data: {
             un: unp,
             pw: pwp
         },
         success: function(data) {
             document.getElementById("errorid").innerHTML = data;
         },
         error: function(err, req) {
             alert("Your browser broke!");
         }
     });
     return false;
 }
What I want is: I want to return false only if there are some values in my data variable. Otherwise I want to return true.
But I can't return false inside this function:
success: function(data) {
             document.getElementById("errorid").innerHTML = data;
         },
So how should I do that?
 
    