0

我正在使用 phonegap 并在页面上进行搜索。表单中的 id 是 mysearch,应该放在 $.get 调用的末尾。我知道调用是正确的,因为我可以将它放在浏览器中并以 json 格式获取所需的输出。问题是我在表单中输入的内容并没有最终进入通话。在通话结束时,我的语法可能不正确。任何帮助将非常感激。表单代码和调用如下。

    <form action="searchresult.html" method="post">
    <input type="search" name="mySearch" id="mySearch" data-mini="true" data-   theme="b" style="color:#888;"
    value="" onfocus="inputFocus(this)" onblur="inputBlur(this)" autocorrect="off" autocomplete="off" autocapitalize="off" />
    </form>

    <script>
     $("#resultPage").live("pageshow", function (){
       $.get("http://www.test.net/jquery/test.cfc?method=getsearch&returnformat=json&searchName=" + $("#mySearch").val(), {},  function(res) {
4

1 回答 1

0

尝试使用 .on insted .live (因为不推荐使用此方法)

  $.get("YOUR URL", function(res) {
   // implement logical
}, 'JSON').error(function(){
   alert('Http error'); // protocol error like 404
});
于 2012-10-25T01:26:34.320 回答