0

我正在尝试在 javascript 中编写一个函数,该函数接收两个参数(目标,内容)以使用 $.load() jquery 函数通过 ajax 加载内容,代码在上面:

 function cargarContenido(content,target) { 
    $(target).load(content);
 }

我这样调用函数,但它不起作用:

<a href="#" onclick="cargarContenido('hd.html','content')">

谢谢!

4

1 回答 1

0

您的目标是无效的选择器。你需要类似的东西#content

<a href="#" onclick="cargarContenido('hd.html','#content')">
于 2012-07-20T18:26:45.613 回答