Click here to Skip to main content
15,901,035 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
The following error comes up in my javascript:

0x800a1391 - Microsoft JScript runtime error: '$' is undefined

this is my code:
JavaScript
<script src="Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        $(document).ready(function () {

            $('#btnLogin').click(function () {

                //                    alert("Please fill in all fields");
                //                }

                //                else {

                var uname = $('#MainContent_tb_UserName').val();
                var pwd = $('#MainContent_tb_Password').val();
                if (uname != "" || pwd != "") {
                    $("#Login").css("display", "none");
                    $("#Loading").css("display", "block");
                    $.ajax({
                        type: "POST",
                        contentType: "application/json; charset=utf-8",
                        url: "Login.asmx/Log",
                        data: "{uname: '" + uname + "',pwd: '" + pwd + "'}",

                        dataType: "json",
                        success: function (result, success) {

                            var status = result.d;
                            if (status == "1") {
                                //                            $("#login").css("display", "none");
                                // response.redirect
                                window.location.href = 'Default.aspx';

                                //clear textboxes
                                $('ContentPlaceHolder1_tb_UserName').val("");
                                $('ContentPlaceHolder1_tb_Password').val("");

                            }
                            else {
                                alert("Login Failed");

                                $("#Login").css("display", "block");
                                $("#Loading").css("display", "none");
                            }

                        },
                        error: function (error) {




                        }

                    });

                }
            });
        });
        </script>



It was working perfectly but now it complains for some reason.

can anyone please help?
Posted
Updated 8-Apr-14 0:06am
v2

Hi
I have tested this. You have issue in like

JavaScript
<script src="Scripts/jquery-1.11.0.min.js" type="text/javascript"></script>


Replace above line with
JavaScript
<script src="Scripts/jquery-1.11.0.min.js" type="text/javascript" />



This was due to Improper closing of script tag. (Also check the path in case issue exists, but the closing issue must be fixed)
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900