Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7011451
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 27, 20262026-05-27T22:07:44+00:00 2026-05-27T22:07:44+00:00

I am using the ajax post method to send values from aspx to php.in

  • 0

I am using the ajax post method to send values from aspx to php.in that i am calling that ajax method a s function in the button click event after inserting the values in the db only i will call the script but when i click the second time only that script is calling how to fix it while clicking at at first time itself?and also this method is not working in the firefox but working in IE when clicking for the second time.

    <script type="text/javascript" language="javascript">
  function resetFields()
  {
     $(document).ready(function(){
    $("#<%=this.btnAdd.ClientID %>").click(function() {
    // we want to store the values from the form input box, then send via ajax below
    var ddlCompany = $("#<%=this.ddlCompany.ClientID %>").attr('value');
    var txtLocation = $("#<%=this.txtLocation.ClientID %>").attr('value');
    var txtDept = $("#<%=this.txtDept.ClientID %>").attr('value');
    var ddlIndustryType = $("#<%=this.ddlIndustryType.ClientID %>").attr('value');
    var txtDesg = $("#<%=this.txtDesg.ClientID %>").attr('value');
    var ddlFnalArea = $("#<%=this.ddlFnalArea.ClientID %>").attr('value');
    var txtExperience = $("#<%=this.txtExperience.ClientID %>").attr('value');
    var txtJobDesc = $("#<%=this.txtJobDesc.ClientID %>").attr('value');
    var txtEducation = $("#<%=this.txtEducation.ClientID %>").attr('value');
    var txtDesiredProfile = $("#<%=this.txtDesiredProfile.ClientID %>").attr('value');
    var txtPositionWanted = $("#<%=this.txtPositionWanted.ClientID %>").attr('value');
    var txtAddedBy = $("#<%=this.txtAddedBy.ClientID %>").attr('value');
    var txtContactName = $("#<%=this.txtContactName.ClientID %>").attr('value');
    var txtEmailid = $("#<%=this.txtEmailid.ClientID %>").attr('value');
    var txtContactno = $("#<%=this.txtContactno.ClientID %>").attr('value');
      $.ajax({
      type: "POST",
       url: "http://172.16.126.32/Riyas/marggroup.com/get-current-openings.php",
      data: "ddlCompany=" + ddlCompany + "& txtLocation="+ txtLocation+"& txtDept="+ txtDept+"& ddlIndustryType="+ ddlIndustryType+"& txtDesg="+ txtDesg+"& ddlFnalArea=" + ddlFnalArea+"& txtExperience="+ txtExperience+"& txtJobDesc="+ txtJobDesc+"& txtEducation="+ txtEducation+"& txtDesiredProfile="+ txtDesiredProfile+"& txtPositionWanted="+ txtPositionWanted+"& txtAddedBy="+ txtAddedBy+"& txtContactName="+ txtContactName+"& txtEmailid="+ txtEmailid+"& txtContactno="+ txtContactno,
      success: function(response){
        $('div.success').html(response);
      }
    });
       return false;
     });
    });
  }
  </script>

codebehind:

protected void btnAdd_Click(object sender, EventArgs e)
  {
c.MyQuery("insert into tblHrims_currentOpeningsNew(nvrDesignation,nvrCompany,nvrExperience,nvrLocation,nvrEducation,nvrDepartment,nvrIndustryType,nvrFnalArea,nvrJobDesc,nvrDesiredProfile,nvrContactPerson," +
" nvrContactNumber,nvrEmailId,nvrWantedPositions,nvrAddedBy,dttAddedon) values('" + txtDesg.Text.Trim().Replace("'", "") + "','" + ddlCompany.SelectedItem.Text + "','" + txtExperience.Text + "','" + txtLocation.Text + "','" + txtEducation.Text + "'," +
" '" + txtDept.Text.Trim().Replace("'", "") + "','" + ddlIndustryType.SelectedItem.Text + "','" + ddlFnalArea.SelectedItem.Text + "','" + txtJobDesc.Text.Replace("'", "''") + "','" + txtDesiredProfile.Text.Replace("'", "") + "'," +
" '" + txtContactName.Text.Trim().Replace("'", "") + "','" + txtContactno.Text.Trim().Replace("'", "") + "','" + txtEmailid.Text.Trim().Replace("'", "") + "','" + txtPositionWanted.Text.Trim().Replace("'", "") + "'," +
" '" + txtAddedBy.Text.Trim().Replace("'", "") + "','" + c.GetValue("select getdate()") + "')");
      string strID = c.GetValue("select max(intsno) from tblhrims_currentopeningsNew");
Page.ClientScript.RegisterStartupScript(this.GetType(), "reset", " resetFields();", true);
}
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-27T22:07:44+00:00Added an answer on May 27, 2026 at 10:07 pm
    1. you can use on event handler in jquery. live, bind and delegate are deprecated in jquery 1.7.
    2. you dont need to use attr('value') instead val() will work.
    3. include datatype = 'html' in ajax call to denote that response will be in html.

    4. Also you have kept $(document).ready(function(){ inside the function resetFields. which is not needed.

    5. remove function resetFields call from button element.

    Then try using below code, i hope it will help you

    String scriptString = "<script type=\"text/javascript\">$(document).ready(function(){
    
        $('#<%=this.btnAdd.ClientID %>').on('click',function(){
        var ddlCompany = $('#<%=this.ddlCompany.ClientID %>').val();
        var txtLocation = $('#<%=this.txtLocation.ClientID %>').val();
        var txtDept = $('#<%=this.txtDept.ClientID %>').val();
        var ddlIndustryType = $('#<%=this.ddlIndustryType.ClientID %>').val();
        var txtDesg = $('#<%=this.txtDesg.ClientID %>').val();
        var ddlFnalArea = $('#<%=this.ddlFnalArea.ClientID %>').val();
        var txtExperience = $('#<%=this.txtExperience.ClientID %>').val();
        var txtJobDesc = $('#<%=this.txtJobDesc.ClientID %>').val();
        var txtEducation = $('#<%=this.txtEducation.ClientID %>').val();
        var txtDesiredProfile = $('#<%=this.txtDesiredProfile.ClientID %>').val();
        var txtPositionWanted = $('#<%=this.txtPositionWanted.ClientID %>')val();
        var txtAddedBy = $('#<%=this.txtAddedBy.ClientID %>').val();
        var txtContactName = $('#<%=this.txtContactName.ClientID %>').val();
        var txtEmailid = $('#<%=this.txtEmailid.ClientID %>').val();
        var txtContactno = $('#<%=this.txtContactno.ClientID %>').val();
    
        $.ajax({
          type: 'POST',
          url: 'http://172.16.126.32/Riyas/marggroup.com/get-current-openings.php',
          data: 'ddlCompany='+ddlCompany+'&txtLocation='+txtLocation+'&txtDept='+txtDept+'&ddlIndustryType='+ddlIndustryType+'&txtDesg='+txtDesg+'&ddlFnalArea='+ddlFnalArea+'&txtExperience='+txtExperience+'&txtJobDesc='+txtJobDesc+'&txtEducation='+txtEducation+'&txtDesiredProfile='+txtDesiredProfile+'&txtPositionWanted='+txtPositionWanted+'&txtAddedBy='+txtAddedBy+'&txtContactName='+txtContactName+'&txtEmailid='+txtEmailid+'&txtContactno='+txtContactno,
          datatype = 'html',
          success: function(response){
            $('div.success').html(response);
            }
          });
       });
     });<s/cript>";
    

    and

    Page.ClientScript.RegisterStartupScript(this.GetType(), "reset", scriptString, true);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am using Ajax POST method to send data, but i am not able
$.ajax({ url: /cgi-bin/stats.exe, method: post, async: false, data: { refresh: a41 } }); Using
How to pass multiple checkboxes using jQuery ajax post this is the ajax function
I'm trying to POST a http request using ajax, but getting a response from
I'm using this to save some data to DB: $(#btnSave).click(function () { $.ajax({ type:
I'm using jQuery.ajax to extract form data from a page, and send it to
i am sending some values via post method to php page in the jquery
I am using the post and get methods for Ajax calls, and have a
When applying the MVP pattern to ASP.NET applications, where does using AJAX to post
I'm using jquery ajax to post updates back to my server. I'm concerned about

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.