jquery, wcf

Below is simple web service called by jquery.
When I comment   var json = $.parseJSON(data); it works ... not sure what's wrong. It does return success when i comment below codes

  var json = $.parseJSON(data);


using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Runtime.Serialization;
using System.ServiceModel;
using System.ServiceModel.Activation;
using System.ServiceModel.Web;
using System.Text;
using System.Web.Script.Serialization;

namespace WcfService
{
    // NOTE: You can use the "Rename" command on the "Refactor" menu to change the class name "Service" in code, svc and config file together.
    // NOTE: In order to launch WCF Test Client for testing this service, please select Service.svc or Service.svc.cs at the Solution Explorer and start debugging.
    [AspNetCompatibilityRequirements
    (RequirementsMode = AspNetCompatibilityRequirementsMode.Required)]
    public class Service : IService
    {
        public System.IO.Stream GetSaleTaxJSon(string CompanyID, string CustomerNo, string ShipToCity, string ShipToState, string ShipToZip, string ShipToCountry)
        {
            #region test            
            var j = new { Result = "1" };
            var s = new JavaScriptSerializer();
            string jsonClient = s.Serialize(j);
            WebOperationContext.Current.OutgoingResponse.ContentType = "application/json; charset=utf-8"; //response to the client
            return new MemoryStream(Encoding.UTF8.GetBytes(jsonClient));
            #endregion      
        }
    }
}





<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <script src="Scripts/jquery-1.4.1.min.js"></script>
    <title></title>
       <script type="text/javascript">
          function GetSaleTax() {
              var city = "EL MONTE";
              var state = "CA";
              var zip = "91731";
              var companyID = "066";
              var country = "USA";
              var customerNo = "337557";
              var GetSaleTaxJSon = "http://localhost:32929/Service.svc?wsdl/WebService/GetSaleTaxJSon";
               
              $(document).ready(function () {
                  $.ajax({
                      crossDomain: true,
                      cache: false,
                      type: "GET",
                      async: false,
                      dataType: "application/json; charset=utf-8", // "text/plain", //response format
                      contentType: "text/plain", //request format                      
                      url: GetSaleTaxJSon + encodeURIComponent("(" + companyID + "," + customerNo + "," + city + "," + state + "," + zip + "," + country + ")"),
                      success: function (data) {
                          var json = $.parseJSON(data);
                          //$('#resultsSaleTax').html('Sale Tax Web Service<br /><br>' + 'Tax Rate: ' + json.SaleTaxRate + "<br />" + 'Status: ' + json.Status);
                          $('#resultsSaleTax').html('Sale Tax Web Service<br /><br>' + 'Tax Rate: ' +   "<br />" + 'Status: ' + json.Status);
                         
                          alert("Success");
                      },
                      error: function (xhr, status, error) {
                          //alert(xhr.responseText + " : error resultsSaleTax");
                          alert("Error");
                      }
                  });
              });
          }
</script>

</head>
<body onload="GetSaleTax()">
    <form id="form1" runat="server">
 <div id="resultsSaleTax">

 </div>
    </form>
</body>
</html>
LVL 1
ITsolutionWizardAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

MlandaTCommented:
You have already requested the data to be returned in JSON format by this line  dataType: "application/json; . So the variable data is probably  already JSON and you don't need to do a parseJSON. It's a good idea to inspect your network traffic, browser side, to see what is being returned from the service and how you can use it. I suggest firebug (http://getfirebug.com)  in Firefox, or the develop tools in Chrome (press F12).
1

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
XML

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.