jQuery Mobile-changePage结果:未定义 [英] JQuery Mobile - changePage result: undefined

查看:106
本文介绍了jQuery Mobile-changePage结果:未定义的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我在使用JQuery Mobile的changePage()函数时遇到一个奇怪的问题.我试图在单击按钮后加载.php页面.

I'm having a strange problem with JQuery Mobile's changePage() function. I'm trying to load a .php page after a button has been clicked.

这是我正在使用的代码:

This is the code I'm using:

/* SUBMIT SEARCH FORM */
$('input#search-submit').click(function() 
{
  $.mobile.changePage("search.php");            
});

但是,单击按钮后,它只会加载显示以下内容的页面:undefined(但是,浏览器中的url是正确的:"http://somedomain.com/search.php").刷新页面后,它也可以很好地显示结果!

After clicking the button however it only loads a page displaying: undefined (the url in the browser however is the correct one: "http://somedomain.com/search.php"). And after refreshing the page it also displays the results just fine!

我的控制台上没有错误或奇怪的警告,所以我不知道为什么它会这种方式...

There are no errors or strange warnings on my console so i can't figure out why it is behaving this way...

推荐答案

我遇到了完全相同的问题,并在以下问题中找到了答案:

I had exactly the same problem, and found the answer in this question:

总结一下-您需要确保要提交的脚本返回完整的jQuery Mobile页面-它需要所有常用的jQuery mobile页面元素,例如带有data-role="content"的div.

To summarise - you need to make sure that the script you're submitting to returns a complete jQuery Mobile page - it needs all the usual jQuery mobile page elements, such as a div with data-role="content".

这篇关于jQuery Mobile-changePage结果:未定义的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆