jQuery忽略响应

Hi anyone see why my alert won't work?

 <script type="text/javascript">
 function SubmitForm(method)
 {
  var login = document.form.login.value;
  var password = document.form.password.value;
  $.post("backend.php", { 
                        login: login, 
                        password: password, 
                        method: method},
                        function(data){
                        alert(data.message); 
                        console.log(data.refresh); 
                      }, "json");
            }
   </script>

Response from backend.php is

backend{"message":"Log in credentials are not correct","refresh":"false"}

Why is 'backend' at the start of your response? I would start by removing that. Everything from { to } looks good.

While I dont think its your problem, the callback function does take a 2nd parameter (the jQuery docs call it "textStatus") which is a textual representation of the HTTP status. Specify a 2nd argument to your callback.

function(data, textStatus) { ...

Great_llama was right, for some reason I had a 'backend' echoed further up the script. Removed this and all go.