[英]How to get JSON / JSONP data using XAMPP local server?
我已經使用XAMPP
設置了本地服務器。 現在,我想從該服務器獲取JSON
/ JSONP
數據。
附帶問題:
Do I need to somehow upload the JSON file on the server? Or is there some
Do I need to somehow upload the JSON file on the server? Or is there some
coding for that? IF yes, which?
Do I need to somehow upload the JSON file on the server? Or is there some
PHP coding for that? IF yes, which?
coding for that? IF yes, which?
我聽說過一些jQuery ajax
調用函數,但是對我來說不起作用。 有任何想法嗎?
您有幾種方法可以做到這一點。 如果結果不是動態的,則只需在服務器上創建一個json文件並使用URL即可獲取。
如果要動態響應發送到服務器的網頁,則可以使用內置的PHP函數json_encode。
請按照php文檔中的json_encode
我認為您不需要做很多事情。 json是格式化數據的一種方式。 您可以使用json_encode()在輸出中返回
一種方法是使用PHP中可用的json_encode()
函數將JSON格式的數據發送到客戶端,並通過提及dataType: json
處理AJAX中的響應
聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.