douhan1992 2010-06-17 13:55 采纳率: 100%
浏览 50
已采纳

你能用jQuery Ajax只返回一个字符串吗?

I have been thinking about this. I am aware you can use json_encode(); to send an encoded array or multi-dimensional array via the jquery ajax call which will interpret the json array for you.

However I am not aware of any other techniques to send more than just a string using echo, print or return from PHP to the jQuery script?

Can someone please enlighten me on this?

Thanks,

Stefan

  • 写回答

2条回答 默认 最新

  • douyuanqia665858 2010-06-17 14:02
    关注

    At the end of the day, you will only be sending a string back to an AJAX request. How you interpret that string in the JavaScript is the part that will affect what you are doing.

    For instance, you can return XML, JSON, plain text, HTML. You can return a CSV file, and parse it in JS. You could even return Markdown if you wanted, then process it with Showdown.

    However, you are only processing strings, not other forms of data. Whatever you can accept and process with JS you can send to an AJAX request as a string.

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(1条)

报告相同问题?

悬赏问题

  • ¥15 写一个方法checkPerson,入参实体类Person,出参布尔值
  • ¥15 我想咨询一下路面纹理三维点云数据处理的一些问题,上传的坐标文件里是怎么对无序点进行编号的,以及xy坐标在处理的时候是进行整体模型分片处理的吗
  • ¥15 CSAPPattacklab
  • ¥15 一直显示正在等待HID—ISP
  • ¥15 Python turtle 画图
  • ¥15 关于大棚监测的pcb板设计
  • ¥15 stm32开发clion时遇到的编译问题
  • ¥15 lna设计 源简并电感型共源放大器
  • ¥15 如何用Labview在myRIO上做LCD显示?(语言-开发语言)
  • ¥15 Vue3地图和异步函数使用