Question: I am using jquery:

```
    $.get(URL, function(data){

            if(data == 'no_credits'){
                alert("no credits");
                return;
            }
            else{
                // WHY HERE>?!
            }

```

and my problem is that url return 'no\_credits' but code goes to `else` block code, please help!

EDIT : `alert(data);` prints no\_credits

Answer: 
Try this:

```
$.get(URL,function(data){...},'text');

```

Your function is outside the $.get function, so of course it doesn't get the server's response as argument.
to send data to front end from backend code....make sure u r not using any function which adds something by itself...like println() function of Java Streams adds one "\n" at the end of string and then sends..use print() function instead...