Click here to Skip to main content
15,900,511 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
XML
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Customer.aspx.cs" Inherits="Customer" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
      <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.7.1.min.js" type="text/javascript"></script>

<script type="text/javascript">

    $(document).ready(function () {
        $("#Submit1").click(function () {
            $.ajax({
                contentType: "text/html; charset=utf-8",

                data:   {ID: $('#Text1').val(),
                        ID2: $('#Text2').val()
                },
                url: "fetchcustomer.aspx",
                dataType: "html",
                success: function (data) {
                    $("#CustomerDetails").html(data);
                }
            });
        });
    });


</script>



</head>
<body>
    <form id="form1" runat="server">
    <input id="Submit1" type="submit" value="submit" />
     <div id="CustomerDetails">
     </div>

    <input id="Text1" type="text" value="thaihcm@aol.com" />
       <input id="Text2" type="text" value="111222" />
    </form>



</body>
</html>


Hi all,
I dont know why when i click button "submit1" it's not working.

pls help.
Posted
Updated 10-Jan-12 6:22am

The problem is case sensitivity.

1) There is no function named Click. It is lower case, click. You should have gotten a JavaScript error on your page when loading in the browser.
2) $("#submit1") should be $("#Submit1") since have named your element with an uppercase first letter.
 
Share this answer
 
Comments
skypoints 10-Jan-12 12:10pm    
Thanks, I changed it into $("#Submit1").click(function (). But it's still not working.
[no name] 10-Jan-12 18:04pm    
Have you debugged? What, specifically, is not working?
Hi, i insert: true false; , now it's working
HTML
<script type="text/javascript">
 
    $(document).ready(function () {
        $("#Submit1").click(function () {
            $.ajax({
                contentType: "text/html; charset=utf-8",
 
                data:   {ID: $('#Text1').val(),
                        ID2: $('#Text2').val()
                },
                url: "fetchcustomer.aspx",
                dataType: "html",
                success: function (data) {
                    $("#CustomerDetails").html(data);
                }
            });
<big>return false;</big>
        });
</script>
 
Share this answer
 
v2

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