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

  • SEARCH
  • Home
  • 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 519323
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T08:01:45+00:00 2026-05-13T08:01:45+00:00

I want to post data to a web service with ajax. there is my

  • 0

I want to post data to a web service with ajax. there is my ajax code:

 function Looping() {
        var Grid = document.getElementById("<%= gvHastalar.ClientID %>");
        var Row;
        var Cell;
        if (Grid.rows.length > 2) {
            for (i = 1; i < Grid.rows.length - 1; i++) {
                Row = Grid.rows[i];
                Cell = Row.cells[3];
                alert(Cell.innerHTML);
                var html = $.ajax(
                {
                    type: "POST",
                    url: "http://localhost:7753/HastaTahlilUyariServisi.asmx/f_HastaninAktarilacakAlislabTestleri",
                    data: "{_sTcKimlikNo:" + Cell.innerHTML + ",_iKlinikKodu:18001,_bAy:12,_iYil:2009}",
                    contentType: "application/json; charset=utf-8",
                    dataType: "json",
                    success: alert('success'),
                    error: alert('error')
                }
                ).responseText;
                Row.style.backgroundColor = "#D3EFD1";
            }
        }
    }

And my webservice function’s code is here:

 [WebMethod]
    [SoapHeader("_ticket", Direction = SoapHeaderDirection.In)]//SoapHeaderDirection.Out
    public DataSet f_HastaninAlisLabTahlilleri(string _sTcKimlikNo, int _iKlinikKodu, byte _bAy, int _iYil)
    {
        try
        {
            string QSelect =
                               @"SELECT * FROM [V_EUCLID_SONUC]
                                 WHERE  MONTH(KAYITTARIHI) = " + _bAy + @"
                                   AND YEAR(KAYITTARIHI) = " + _iYil +
                                   AND TCKIMLIKNO = '" + _sTcKimlikNo + @"'";

            return dbA.ExecuteDataSet(CommandType.Text, QSelect);
        }
        catch (Exception ex)
        {
            throw (ex);
        }
    }

There is a break point on function which is in the web service but debug never go that break point. I pasted webservice’s url from browser but may be url is wrong. And when i run project, i have 3 alert.
First Cell’s text its normal.Second alert is success and the last alert is error. I want to send parameters to f_HastaninAlisLabTahlilleri and user return dataset. How can i do this?

Thanks in advance

  • 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-13T08:01:45+00:00Added an answer on May 13, 2026 at 8:01 am

    Here are a few remarks about your code:

    1. success and error are callback functions, they should be defined like this:

      success: function(data) { alert('success'); },
      error: function(XMLHttpRequest, textStatus, errorThrown) { alert('error'); }
      
    2. ASMX web services use SOAP by default unless you decorate them with ScriptServiceAttribute in which case JSON could be used to invoke a method. It is not clear from your code if the web service is decorated with this attribute.
    3. When you pass parameters, you need to encode them, use JSON. stringify instead of concatenating strings:

      data: JSON.stringify({_sTcKimlikNo: Cell.innerHTML, 
                            _iKlinikKodu: 18001,
                            _bAy: 12,_iYil: 2009});
      

    Use FireBug to inspect network AJAX requests and server responses and post them on StackOverflow to facilitate debugging.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

The code I want to work: $.ajax({ type: POST, url: _Source/ajap/ajap.nlSrch.php, data: { sndJson
I want to Access php web service using ajax jquery This is my code:-
I want to post some data to a file via ajax when somebody clicks
jquery looks like this $.post('JSP/processForm.jsp', $(#Form).serialize(), function(data){ //I want to iterate through every line
I am getting my data from a web service using ajax call. i am
I have a jquery ajax call asp.net web service question. I want to validate
how can I post data without using NameValuePair ? I want to post String
I have an ASP.NET application in which i want to post data using jQuery
I want to post some data via javascript to another domain. Something like: http://www.othersite.com/submitfunnyname?name=blah
I want to send the post data from an input like this: <input type=file

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.