javascript - PHP adding unwanted line break to ajax result -


why php adding line break simple ajax result? couldn't easier. missing something?

here js:

$(document).ready(function() {     $('#inputemail').change(function(){         // check see if email exists         var email = $('#inputemail').val();         //alert(email);         $.ajax({             url : "php/checkuseremail.php",             type: "post",             datatype: "text",             data: {email: email},                             success: function(data){                 alert(data);                 if(data === "exists"){                     alert(data);                                         }                                 },             error: function (jqxhr, textstatus, errorthrown)             {                 alert("ajax error");             }         });                   }); }); 

here php:

<?php   include_once("db_connect.php");  // catch results sent via $.post , assigns them php variables. $email = $_post['email'];  // check see if email exists $sql = "select * users email = '$email'"; $conn->prepare($sql); $result = $conn->query($sql); $rowcnt = $result->num_rows;  if($rowcnt == 0){     echo trim('new'); }else{     echo trim('exists'); } 

for whatever reason, result data string returned /r/nexists, rather exists, , never gets if block, if use == evaluate condition. tried adding trim() function can see without result. appreciated has taken me hours of time stupid if condition.

check if there "empty" space after or before php question marks, line-breaks represented part of response.

i mean here <?php?> , here 

Comments

Popular posts from this blog

css - SVG using textPath a symbol not rendering in Firefox -

Java 8 + Maven Javadoc plugin: Error fetching URL -

order - Notification for user in user account opencart -