从服务器获取JSON格式的响应而不使用数据库? [英] Get the response from server in JSON format without using database?

查看:118
本文介绍了从服务器获取JSON格式的响应而不使用数据库?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我是服务器端编程的新手,我有一个form,并且需要执行的操作是,当用户填写名称,地址和个人识别码时,应加载从那时提交的页面(例如来自提交的本机)和新数据应该显示(数据在JSON文件中可用).

我在服务器上有JSON文件.是否可以在不使用数据库的情况下以JSON格式从服务器获取响应?

HTML:---

<form action="https://domain.com/jsonfilelocation/json.json">
    <input type="text" name="name" />
    <input type="text" name="address" />
    <input type="text" name="pincode" />
    <input type="submit" name="submit" />        
</form>

JSON:---位于https://domain.com/jsonfilelocation/json.json

中的json.json

{
    "name": "kk",
    "address": "XYZ, New Delhi",
    "pincode": "1000001"
}

解决方案

您可以将JSON字符串存储在本地变量服务器端,并将其作为客户端AJAX调用的结果返回,而无需访问数据库. /p>

I am new to server side programming, I have a form and action required is, when user fill the name, address and pin code, submit the from then page should be load (like native from submit) and new data should be display (data is available in JSON file).

I have JSON files on the server. Is it possible to get the response from server in JSON format without using database??

HTML:---

<form action="https://domain.com/jsonfilelocation/json.json">
    <input type="text" name="name" />
    <input type="text" name="address" />
    <input type="text" name="pincode" />
    <input type="submit" name="submit" />        
</form>

JSON:--- json.json located in https://domain.com/jsonfilelocation/json.json

{
    "name": "kk",
    "address": "XYZ, New Delhi",
    "pincode": "1000001"
}

解决方案

You can store your JSON string in a local variable server side and have it returned as the result of a client side AJAX call without having to access a database.

这篇关于从服务器获取JSON格式的响应而不使用数据库?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆