Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
276 views
in Technique[技术] by (71.8m points)

javascript - jQuery, getting "500 Internal Server Error" when running a jQuery statement

Whenever the jQuery is triggered I recieve the error 500 Internal Server Error, does anyone have any ideas why the code below might be causing this?

<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<script src="../meta/js/jquery-1.7.2.js"></script>
<script>

    $(document).ready(function() {
        $('#form1').submit(function(e){
            e.preventDefault();
            alert('I clicked it');
        });
    });

</script>
</head>
<body>

<form name="form1" method="post">
    <button id="button">grab user data</button>
    <select></select>
</form>

</body>
</html>
See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

I'm gonna guess its because of this variable:

<%=button.ClientID %>

There is nothing else (shown) that would signify anything else that would throw an error.

Can you clarify what you mean by 'jQuery is triggered'? Does that mean upon 'click' ? Or just by loading this page (I assumed the later)


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

2.1m questions

2.1m answers

60 comments

56.8k users

...