Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

114
Views
How to use forASP.NET

How can i use a button in my a.asp view to submit the button itself.

I tried like below, but I don't know how to pass the button as an parameter as there 's ajax calls, I want to use the button to submit a to the server.

<script type="text/javascript"> 
    $(document).ready(function () { 
        var params = { 
            title: 'Hello' 
        }; 

        $("#button").live( "click", function () { 
            $.ajax({ 
                url: '<%= URL.Action("ajaxNew" , "Home") %>', 
                crossDomain: true, 
                data: { 
                    buttonId: $(this).attr("id"), 
                    buttonName: $(this).attr("name"), 
                    shareForm: $(this).parents("form").children("form").children("input.button"), 
                }, 
                error: function() { 
                    console.log(error); 
                } 
            }); 
        }); 
    }); 
</script> 
about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

If you want to pass data with a button,try to use onclick:

<button id="button" name="button" onclick="test(this)">button</button>

js:

function test(t) {
            $.ajax({
                url: '<%= URL.Action("ajaxNew" , "Home") %>',
                crossDomain: true,
                data: {
                    buttonId: $(t).attr("id"),
                    buttonName: $(t).attr("name"),
                },
                error: function () {
                    console.log(error);
                }
            });
        }

If you want to pass form data,you needs to get data from the form one by one,and put them into data.

about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!