Can you return a string with jQuery Ajax only?

I thought about it. I know you can use json_encode (); to send a encoded array or multidimensional array via jQuery ajax call that will interpret the json array for you.

However, I don’t know of other sending methods than just strings using echo, print, or return from PHP in a jQuery script?

Can someone please enlighten me on this?

Thank,

Stephen

+3
source share
2 answers

At the end of the day, you will send the string back to the AJAX request. How you interpret this line in JavaScript is the part that will affect what you do.

, XML, JSON, , HTML. CSV JS. Markdown, , Showdown.

, . , JS, AJAX .

+5

, , , http, .

. mp3. , , .

, :).

0

Source: https://habr.com/ru/post/1750503/


All Articles