0

I want to insert some stuff generated by a PHP code into my HTML document, because I can't use innerHTML with .php extension, but I need that for some ajax. I tried jquery .load() and get(), but I can't get that to work, I'm not really a jquery guy:D

$.get("diaknev.php", function(data) { 

    $('#sajt').html(data);

});
4

1 回答 1

2

使用 URL 的绝对路径:

$.get("/absolute/location/of/diaknev.php", function(data) { 
    $('#sajt').html(data);
});

使用浏览器中的 WebDeveloper Tools (IE 中的 F12)来跟踪 HTTP 并查看网络上发生的情况。

PS考虑$.ajax直接使用并设置dataType'text'.

于 2013-07-16T12:58:44.797 回答