jquery mobile autocomplete throws error $(...)不是函数

时间:2014-11-10 22:40:04

标签: javascript jquery jquery-mobile asp-classic

我有以下代码。一切都工作正常,除了我的jquery移动自动完成它说TypeError $(...)。on不是一个函数我将发布我的所有代码但只需要帮助底部。

<%
    Option Explicit
    Response.Expires = 0
    Response.Buffer = TRUE

REM -------------------------------------------------------------
REM  Define Global Variables
REM -------------------------------------------------------------
Dim blnBypassRedirect
Dim StrDescription
Dim strRequesterName
Dim strAction
Dim strTaskID
Dim strAssignUserID
REM -------------------------------------------------------------
REM Include files
REM -------------------------------------------------------------
%>
<!--#Include Virtual="/include/allinclude.asp" -->
<!--#Include Virtual="/GYGlobal/include/tasks.asp" -->
<!--#Include Virtual="/GYGlobal/include/hierarchy.asp" -->
<%

    blnBypassRedirect = UCase(Trim(Request("hidByPassRedirect"))) <> "Y"
    strDescription  = (Request("txtDescription"))
    strRequesterName  = (Trim(Request("txtRequesterName")))
    strAction           = Trim(UCase(Request("hidAction")))
    strTaskID           = Trim(UCase(Request("hidRandomID")))
    strAssignUserID   = Ucase(Trim(Request("cboAssignUserID")))


    If (blnBypassRedirect) Then
        If InStr(LCase(Request.ServerVariables("HTTP_USER_AGENT")), "blackberry") > 0 Then
            'If InStr(LCase(Request.ServerVariables("HTTP_USER_AGENT")), "webkit") > 0 Then
                'If (gblnProdServer) Then
                    Response.Redirect("http://m.wingfootct.com/blackberry.asp")
                'Else
                '   Response.Redirect("http://testm.wingfootct.com/blackberry.asp")
                'End If
            'End If
        End If
    End If

    Call Mainline

    Response.Flush

Sub Mainline
  Call InitVars
  Call WriteHTML
End Sub

If strAction <> "" Then
    Call MobileTaskUpdate
End If

Sub InitVars
    Call InitAll

   gstrTitle = "Goodyear Commercial Tire & Service Centers"
   'blnIsTool = True
End Sub
Sub WriteHTML
    Dim strTemp

%><!DOCTYPE html>
<html>
    <head>



<!-- #include virtual="/include/allinclude.js" -->

    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, minimum-scale=1, maximum-scale=1">

<style>
tr{
    border-bottom: 1px solid lightblue;

}
th {
    border-bottom: 3px solid #6b93bb;
}
    </style>


    <title>Goodyear Commercial Tire & Service Centers | Mobile</title>




    <% WriteStyleSheet() %>

</head>
<body>


<% WriteHeader("Tasks") %>



<script>





    function cmdInstallApprove_click(strTaskID){
                jQuery.ajax({
                type: "POST",
                url: "/tools/tasks-ajax.asp",
                data: 'hidAction=T&hidRandomID='+strTaskID,
                success: function(msg){
                    alert('Updated');
                    window.location.reload(true);



                    }
                }
            );
}





    </script>

<ul id="autocomplete" data-role="listview" data-inset="true" data-filter="true" data-filter-placeholder="Find a city..." data-filter-theme="a"></ul>


<div data-role="collapsible" data-collapsed="false" data-icon="plus" data-theme="b">
            <h3>Approve Tasks</h3>
            <% Call WriteTaskApproval %>

        </div>


        <div data-role="collapsible" data-icon="plus" data-theme="b">
            <h3>Unassigned Tasks</h3>
            <% Call WriteUnassignedTasks %>
        </div>





<% WriteFooter() %>

</form>

</body>
</html>
<%
End Sub

Sub WriteTaskApproval
Dim strQString
Dim strName
Dim strAddUserID
Dim strMgmtApprovUser
Dim strError
Dim i
Dim intCount


Dim objTasksApproval : set objTasksApproval = new clsTasks
With objTasksApproval
.blnTest              = Not(gblnProdServer)
.strName              = strName
.strAddUserID         = strAddUserID
.strMgmtApprovUser  = strMgmtApprovUser
.strDescription       = strDescription
.strRequesterName     = strRequesterName
.strTaskID            = strTaskID
.TaskApproval()
If .blnEOF Then
            strError =  "No tasks for you to approve.<br>"
            Response.Write strError
Else
Response.Write "<table data-role=""table"" data-mode=""columntoggle"" class=""ui-responsive ui-shadow""  id=""taskTable"">" & vbCrLf
            Response.Write "<thead>" & vbCrLf
            Response.Write "<tr>" & vbCrLf

            Response.Write "<th>Approve</td>"
           Response.Write "<th>Task Name</td>"
            Response.Write "<th>Assigned Analyst</td>"

                Response.Write "</tr>" & vbCrLf & vbCrLf
                Response.Write "</thead>" & vbCrLf & vbCrLf

                Response.Write "<tbody>" & vbCrLf
            i = 0
            intCount = 0
                Do While Not .blnEOF
Response.Write "<td style=""white-space: nowrap;"" data-icon=""check"" data-inline=""true"" data-theme=""b"" data-role=""button"" onclick=""return cmdInstallApprove_click  ('" & .strTaskID & "');"">"
Response.Write "<td style=""white-space: wrap;""> <a href = ""descriptionPage.asp?txtDescription=" & .strDescription  & "&hidRandomID=" & .strTaskID & "&txtRequesterName=" & .strRequesterName & """ >" & .strName & "</a>" & "</td>" & vbCrLf
'Response.Write "<td style=""white-space: wrap;""> <a href = ""dialogPage.asp?txtDescription=" & .strDescription & """ data-rel=""dialog"">" & .strName & "</a>" & "</td>" & vbCrLf
'Response.Write "<td style=""white-space: wrap;""> <a href = ""dialogPage.asp"" data-rel=""dialog"">" & .strName & "</a>" & "</td>" & vbCrLf
Response.Write "<td style=""white-space: nowrap;"">" & .strAddUserID & "</td>" & vbCrLf

Response.Write "</tr>" & vbCrLf & vbCrLf
i = i + 1
               intCount = intCount + 1
               If i = 2 then
                  i = 0
               End If
               .MoveNext
            Loop
            Response.Write "</tbody>" & vbCrLf
            Response.Write "</table>" & vbCrLf

End If
End With

    Set objTasksApproval = Nothing
End Sub

Sub WriteUnassignedTasks
Dim strQString
Dim strName
Dim strAddUserID
Dim strMgmtApprovUser
Dim strError
Dim i
Dim intCount

Dim objTasksApproval : set objTasksApproval = new clsTasks
With objTasksApproval
.blnTest              = Not(gblnProdServer)
.strName              = strName
.strAddUserID         = strAddUserID
.strMgmtApprovUser  = strMgmtApprovUser
.strDescription       = strDescription
.strRequesterName     = strRequesterName
.strTaskID            = strTaskID
.strAssignUserID      = strAssignUserID

.MobileUnassignedTask()
If .blnEOF Then
            strError =  "No tasks.<br>"
            Response.Write strError
Else
Response.Write "<table data-role=""table"" data-mode=""columntoggle"" class=""ui-responsive ui-shadow""  id=""taskTable"">" & vbCrLf
            Response.Write "<thead>" & vbCrLf
            Response.Write "<tr>" & vbCrLf
            Response.Write "<th align=""Center"" >Task Name</td>"

            Response.Write "</tr>" & vbCrLf & vbCrLf
                Response.Write "</thead>" & vbCrLf & vbCrLf

                Response.Write "<tbody>" & vbCrLf
            i = 0
            intCount = 0
                Do While Not .blnEOF

Response.Write "<td style=""white-space: wrap;""> <a href = ""UnassignedTasks.asp?txtDescription=" & .strDescription  & "&hidRandomID=" & .strTaskID & "&txtRequesterName=" & .strRequesterName & "&cboAssignUserID=" & .strAssignUserID &""" >" & .strName & "</a>" & "</td>" & vbCrLf
Response.Write "</tr>" & vbCrLf & vbCrLf
i = i + 1
               intCount = intCount + 1
               If i = 2 then
                  i = 0
               End If
               .MoveNext
            Loop
            Response.Write "</tbody>" & vbCrLf
            Response.Write "</table>" & vbCrLf

End If
End With
    Set objTasksApproval = Nothing
End Sub



%>

<script>




     $( document ).on( "pagecreate", "#default", function() {
    $( "#autocomplete" ).on( "filterablebeforefilter", function ( e, data ) {
        var $ul = $( this ),
            $input = $( data.input ),
            value = $input.val(),
            html = "";
        $ul.html( "" );
        if ( value && value.length > 2 ) {
            $ul.html( "<li><div class='ui-loader'><span class='ui-icon ui-icon-loading'></span></div></li>" );
            $ul.listview( "refresh" );
            $.ajax({
                url: "http://testm.wingfootct.com/tools/tasks/source.asp",
                dataType: "json",
                crossDomain: true,
                data: {
                    q: $input.val()
                }
            })
            .then( function ( response ) {
                $.each( response, function ( i, val ) {
                    html += "<li>" + val + "</li>";
                });
                $ul.html( html );
                $ul.listview( "refresh" );
                $ul.trigger( "updatelayout");
            });
        }
    });

});

</script>

0 个答案:

没有答案