ashok kumar

ashok kumar

  • NA
  • 89
  • 35.4k

Zero alone is missing in paramter list when call webservice

Oct 21 2013 7:27 AM
Hi,
    My Problem looks really strange,iam calling an Autocomplete.asmx Web method from jquery.first time the first parameter 0 is passing the second time the Zer0 is geting diappeared,instead of 0 if any other numbers are there they are getting displayed.
 Aspx:
  function SearchText() {
                $('#<%=txtphoneno.ClientID%>').autocomplete({
                    source: function (request, response) {
                        Search();
                    }
                });
            }
            //-->loadtop 5 jobs 
            function Search() {
                var callid = $('#<%= txtphoneno.ClientID%>').val().toString();
              //  alert(callid);
                $.ajax({
                    type: "POST",
                    contentType: "application/json; charset=utf-8",
                    url: "../HttpHandler/Autocomplete.asmx/GetCallername",
                    data: "{'callerid':" + callid + "}",
                                 dataType: "json",
                    success: function (data) {
                        //response(data.d);
                        //  alert(data.d);
                        $('#<%=txtname .ClientID %>').removeClass('text-label');
                        $('#<%=txtname .ClientID %>').addClass('lbls');
                        $('#<%=txtnote .ClientID %>').removeClass('text-label');
                        $('#<%=txtnote .ClientID %>').addClass('lbls');


                        document.getElementById('<%=txtname .ClientID %>').value = data.d[0];
                       
                        document.getElementById('<%=txtnote .ClientID %>').value = data.d[1];
                        
                        if (data.d != 'User Doesnt Exist') {

                            var param = $('#<%= txtphoneno.ClientID%>').val();
                                      $("#<%=IframeJobHistory.ClientID%>").show();

                                      LoadHistoryDetails(param);
                                  }
                                  else {
                                      // $("#<%=IframeJobHistory.ClientID%>").hide();

                                  }
                    },
                    error: function (result) {
                        // alert("Error");
                    }
                });
            }


CS Code AutoComplete.Asmx

  [WebMethod ]
        public string [] GetCallername(String callerid)
        {
            ..............................
                return CallerDetails;
            
        }
    }

In the String callerid, first time when the user enters 0 iam getting 0 ,second time when the user enters any number iam getting the number but the Zero disappears.

If i use any other number,apart from zero things are working fine. Pls help me out.