KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I see quite a few different issues with the alert window and new lines. Most are that the \n is considered a new line in PHP rather than getting sent to javascript. In my case, the string is being outputted in a new window showing \n . I just tried actually writing \n into an alert box via jsfiddle, and that worked, so it must be my method of doing things... Here is the string returned to console. as you can see, the \n is definitely there: Username is required\nPassword is required\nEmail is required\nPhone is required\nCardnumber is required However, it shows up like this: Why is this happening? I think it may have something to do with the data type, as it is returned from $.ajax if (canAjax && !try_ajax) { e.preventDefault(); $.ajax({ type: "POST", url: "mobilesubmit.php", data: {"use_ajax": true, "formdata": $("#register_form").first().serializeArray()}, success: function(data) { // This stupid thing should make new lines! alert(data); console.log(data); }, error: function (request, status, error) { try_ajax = true; $("#register_form").submit(); } }); }
Tags (comma-separated)
Save Edits
Cancel