-3

我有以下教程中的代码,我想要操作,但我只想删除警报,

这是代码:

<script type="text/javascript">
setTimeout('read()', 10000);

function read()
{
FB.api('/me/news.reads' + 
'?article=<?php echo $fbrdurl ?>&access_token=<?php echo $access_token ?>','post',
function(response) {
var msg = 'Error occured';
if (!response || response.error) {
if (response.error) {
msg += "\n\nType: "+response.error.type+"\n\nMessage: "+response.error.message;
}
alert(msg);
} 
else {
alert('Post was successful! Action ID: ' + response.id);
}
});
}
</script>

我试过这个:

<script type="text/javascript">
setTimeout('read()', 10000);

function read()
{
FB.api('/me/news.reads' + 
'?article=<?php echo $fbrdurl ?>&access_token=<?php echo $access_token ?>','post';
}
</script>

但没有用,谢谢

4

2 回答 2

1

如果您尝试做的只是忽略响应(删除警报对话框):

function read()
{
  FB.api('/me/news.reads' + 
  '?article=<?php echo $fbrdurl ?>&access_token=<?php echo $access_token ?>','post',
   function(response) {});
}
于 2012-07-08T21:11:24.907 回答
0

如果您没有在其他任何地方使用 alert() 函数,则可以简单地覆盖它,使其不执行任何操作:

window.alert = function() {};
于 2012-07-08T21:19:40.633 回答