Hi all i am writing a Rails application and i include some link_to_remote links The generated code is
大家好我正在写一个Rails应用程序,我包括一些link_to_remote链接生成的代码是
<a href="#" onclick="new Ajax.Request('/b10/categories/games?category=Action', {asynchronous:true, evalScripts:true}); return false;">Test</a>
That works perfectly fine on Safari and Firefox but when i try to click the link on IE7 and Opera it does not even hit the server.
这在Safari和Firefox上完全正常,但当我尝试点击IE7和Opera上的链接时,它甚至没有打到服务器上。
Any hints ?
任何提示?
2 个解决方案
#1
Use a fully qualified URL: http://.....
使用完全限定的URL:http:// .....
#2
This is a bad practice to include all of this code in the <a href>
tag anyways. I suggest you make a function such as:
无论如何,将所有这些代码都包含在标记中是一种不好的做法。我建议你做一个如下功能:
function doAjax(url)
{
new Ajax.Request(url, {asynchronous:true, evalScripts:true});
return false;
}
in the javascript code. And change the url to say instead:
在JavaScript代码中。并改变网址来代替:
<a href="#" onclick="return doAjax('/b10/categories/games?category=Action');">
Test</a>
#1
Use a fully qualified URL: http://.....
使用完全限定的URL:http:// .....
#2
This is a bad practice to include all of this code in the <a href>
tag anyways. I suggest you make a function such as:
无论如何,将所有这些代码都包含在标记中是一种不好的做法。我建议你做一个如下功能:
function doAjax(url)
{
new Ajax.Request(url, {asynchronous:true, evalScripts:true});
return false;
}
in the javascript code. And change the url to say instead:
在JavaScript代码中。并改变网址来代替:
<a href="#" onclick="return doAjax('/b10/categories/games?category=Action');">
Test</a>