ajax refresh the whole page inside a div instead of reloading the div content

时间:2015-05-12 23:18:13

标签: javascript php ajax wordpress

Ajax refresh the div. but the thing is it refresh the whole page inside the div. it's like page inside page. i know that i did something wrong.

I'm working on a wordpress website(locally). where i want to change the images of the presenter as soon as there shows begin. Ajax script looks fine, but doesn't work the way i want. So, i need your help guys.........

I placed my code below. the div that i want to refresh is in layout page and the ajax script is in the footer page

Wordpress Template:

nvarchar

1 个答案:

答案 0 :(得分:0)

我不熟悉wordpress,但是ajax-wise,你必须有一个url,请求将获取你的div的新内容。例如,您的页面位于example1.com上,因此您必须为example1.com/get-my-div创建一个菜单处理程序, 这样页面只返回你的div内容。 您的ajax调用中的url被省略,并且默认为当前页面。这就是为什么你在页面中有一个页面,因为整个页面的内容显示在div