-2
我有這個JSON文件:的jQuery的getJSON()請求,並沒有任何反應
{
"name": "RushaliB",
"email" : "[email protected]",
}
我嘗試用這個代碼來獲得一個靜態的HTML頁面:
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<title>multiple languages using Jquery and JSON</title>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.1/jquery.min.js"></script>
</head>
<script>
$.getJSON('json/main.json', function(data) {
$('#result').html(data.name + ' : ' + data.email);
});
</script>
</body>
</html>
我的網頁是空的,我不明白。非常感謝您的幫助。
ID爲「result」的元素在哪裏? – Alessandro
你的元素與'id''結果在哪裏? –