我正在嘗試利用JQuery Ajax調用JavaScript文件。我需要傳遞一些參數,但我不確定如何使用JavaScript(PHP似乎更簡單)。這裏是我的電話:調用JS文件時從JQuery Ajax調用中檢索參數
function getDocument(parameters) {
$.ajax({
type: "GET",
url: "js/document.js",
dataType: "script",
data: "info=hellothere",
success: function(msg) {
},
error: function(jqXHR, textStatus, errorThrown){
}
});
}
所有我想要做的,是打印出document.js
參數「信息」的內容,所以基本上是應打印「hellothere」。