为什么我的 javascript 在调用 ajax 时不起作用?用jquery
好吧,假设我正在做类似
http://localhost/ajax/social/pull/facebookstatus
的 事情我的 /ajax/social/pull/facebookstatus
有一个脚本,类似于
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create our data table.
var data = new google.visualization.DataTable();
我试图调用的问题(让我们说在 http://localhost/myprofile )
$.ajax({
type: "POST", // Using the POST method
url: "/ajax/social/pull/facebookstatus", // The file to call
data: myfbdata,
dataType: 'html',
success: function(data) {
$('#ajax-placeputfb').hide().fadeIn(3000).html(data);
}
});
在 /ajax/social/pull/facebookstatus
上加载的脚本在 http://localhost 上加载时不起作用/myprofile
有问题吗?
谢谢
亚当·拉马丹
ok lets say im doing something like
http://localhost/ajax/social/pull/facebookstatus
on my /ajax/social/pull/facebookstatus
there is a script something like
<script type="text/javascript" src="https://www.google.com/jsapi"></script>
<script type="text/javascript">
// Load the Visualization API and the piechart package.
google.load('visualization', '1', {'packages':['corechart']});
// Set a callback to run when the Google Visualization API is loaded.
google.setOnLoadCallback(drawChart);
// Callback that creates and populates a data table,
// instantiates the pie chart, passes in the data and
// draws it.
function drawChart() {
// Create our data table.
var data = new google.visualization.DataTable();
back to the problem im trying to call ( lets say at http://localhost/myprofile )
$.ajax({
type: "POST", // Using the POST method
url: "/ajax/social/pull/facebookstatus", // The file to call
data: myfbdata,
dataType: 'html',
success: function(data) {
$('#ajax-placeputfb').hide().fadeIn(3000).html(data);
}
});
the script on /ajax/social/pull/facebookstatus
doesnt work when its loaded on http://localhost/myprofile
is there a problem?
Thanks
Adam Ramadhan
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这是一个相关的问题吗? 通过ajax加载html页面时,会加载脚本标签吗?
当lib未包含在
中时,我遇到了类似的问题
也许你可以尝试将其包含在主文档的
标记
;
is this a related question? When loading an html page via ajax, will script tags be loaded?
A similar issue I had when the lib was not included in the
<head>
Maybe you can try including this in the
<head>
tag of your main document<script type="text/javascript" src="https://www.google.com/jsapi"></script>