zoukankan      html  css  js  c++  java
  • Easyui form 处理 Laravel 返回的 Json 数据

    默认地,Easyui Form 请求的格式是 Html/Text,如果服务端 Laravel 返回的数据是 Json 格式,则应当在客户端进行解析。以下是 Easyui 官方文档的说明:

    Handle submit response

    Submitting an ajax form is very simple. Users can get the response data when the submission is finished. Notice that the response data is the raw data from server. A parse action to the response data is required to get the correct data.

    For example, response data is assumed to be JSON, a typical response data may look like this:

    1. {
    2. "success": true,
    3. "message": "Message sent successfully."
    4. }

    Now handle the JSON string in 'success' callback function.

    1. $('#ff').form('submit', {
    2. success: function(data){
    3. var data = eval('(' + data + ')'); // change the JSON string to javascript object
    4. if (data.success){
    5. alert(data.message)
    6. }
    7. }
    8. });
  • 相关阅读:
    day02-数据库操作
    day01-MySQL介绍
    3-socketserver
    1-多线程与多进程
    keyword模块
    math模块
    查看进程pid与ppid
    开启进程的两种方式
    进程理论
    进程
  • 原文地址:https://www.cnblogs.com/mouseleo/p/8471426.html
Copyright © 2011-2022 走看看