Domanda

I have this form:

    <form id="form21" runat="server" method="post" onsubmit="return send()">
          <asp:Button runat="server"  ID="submit" name="submit" type="submit" class="btn btn-send" Text="עדכן" onclick="submit_Click" />
          <asp:Button ID="other" name="other" runat="server" class="btn btn-send" onclick="other_Click" Text="control" Visible="False"/>
    </form>

The "other_Click" method loads data from my database.

I don't want the button: "other" use the "onsubmit='return send()'". Can I do that?

È stato utile?

Soluzione

Why are you using a FORM to achive it ?? in this case at my personal advice it will be more simple this approach : a simple button which call a javascript function to retrieve data and then you may use this data as per your need. In example:

<input type="button" id="ID" name="ID" value="Get Data" onclick="YourFunction"/>

<script type="text/javascript">
 function Yourfunction()
     {
        $.ajax({
         type: "POST/GET", url: url, data: p,
         success: function (msg) {
          //tmp = JSON.parse(msg); if needed
          //do something here
         },
         error: function (msg) {
           //do something here
         }
      });
     }
</script>

However if may give us more info it would be better to better help you

Autorizzato sotto: CC-BY-SA insieme a attribuzione
Non affiliato a StackOverflow
scroll top