D
D
Danil Ostapenko2021-07-30 00:20:12
AJAX
Danil Ostapenko, 2021-07-30 00:20:12

How to pass a wrap to alert in a PHP variable passed by AJAX to JS?

Good day, tell me AJAX that flies back in one line looks like this:

This is not your property ID: 26748 ( Test Testovich test_adm\nThis is not your property ID: 26747 ( Test Testovich test_adm\nThis is not your property ID: 26746 ( Test Testovich test_adm\nThis is not your property ID: 26745 ( Test Testovich test_adm\n


It is formed on the side of the executing file in this form through a loop and glued into one line:

$response[$i++] = 'Это не Ваш объект ID: '.$what_is_id.' ( '.get_the_author_meta('first_name').' '.get_the_author_meta('last_name').' '.get_the_author_meta('user_login').'\n';


I convert the whole array into one line through:
implode($response)

And I display it through alert and everything is displayed in one line, I already tried to escape and \\n\\r and "\"n"\"r does not help, maybe these are some AJAX features? tell me who knows how to send a string separator in an array?

61031bede1e78510687808.png

Answer the question

In order to leave comments, you need to log in

1 answer(s)
M
maddog670, 2021-07-30
@Arh1diablo

."\n";

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question