Как в javascript подключить файл php с параметром?
Есть часть кода
cols.push($("<td>")
.attr('class', 'namecell')
.append($("<span>")
.attr('class', 'accountname')
.data('id', accounts[index].index)
.text(accounts[index].accountName)
)
.append($('<a>')
.attr('title', "Edit")
.attr('class', 'cellOptionButton')
.on('click', {
"index": accounts[index].index
}, function(event) {
edit(event.data.index);
})
.append($('<span></span>')
.attr('class', 'glyphicon glyphicon-wrench')))
.append($('<a>')
.attr('title', 'Details')
.attr('class', 'cellOptionButton')
.on('click', {
"index": accounts[index]["index"]
}, function(event) {
showdetail(event.data.index);
})
.append($('<span class="glyphicon glyphicon-eye-open"></span>')))
);
Как вместо кода .text(accounts[index].accountName) (Шестая строка в коде)
подключить php файл с параметром?
.text(/mod.php?param=accounts[index].accountName) (Эту строку не знаю как сделать.)
А в этом файле будет file_get_contents и тд.
Можно конечно и не подключать файл, там код не большой, а прямо в JS прописать как-то немного php.
Ответы (1 шт):
Автор решения: mepihindeveloper
→ Ссылка
Если я правильно понял задачу, то вам необходимо использовать метод load. Пример использования: $("#id").load("test.php");