title: Failing to Pass String Parameters in a jQuery ajax call to an ASP.NET webmethod
body: <p>I am having some issues with Passing Parameters in a jQuery ajax call to an ASP.NET webmethod and it is <strong>BUGGING</strong> me all day long.</p>
  
  <p>I've seen the solution of how it is being done and yet it is not working for me.</p>
  
  <p>Here is some code:</p>
  
  <pre><code>function GetString() {
  
      var name = "yan";
      var fam = "key";
      alert(name + " " + fam);
  
      $.ajax
  ({
      type: "GET",
      url: "'Services/MyService.asmx/returnString",
      dataType: "json",
      //data: "{ 'fname' : '" + name + "' , 'lname' : '" + fam + "'}",
      //data: "{ 'fname' : 'name' , 'lname' : 'fam'}",
      //data: '{"fname":"Chris","lname":"Brandsma"}',
      data: "{'fname':'Chris','lname':'Brandsma'}",
      contentType: "application/json; charset=utf-8",
      error: function (jqXHR, textStatus, errorThrown)   //what to do if fails
      {
          alert('bad, ' + errorThrown + ", " + jqXHR.responseText + ", " + textStatus);
      },
      success: function (data)           //what to do if succedded
      {
          alert(data.d);
      }
  });
  </code></pre>
  
  <p>}</p>
  
  <pre><code>[WebMethod]
  [ScriptMethod(UseHttpGet = true)]
  public string returnString(string fname, string lname)
  {
      return ("my name is " + fname + " " + lname);
  }
  </code></pre>
  
  <p>and that's the error I get:
  <img src="https://i.stack.imgur.com/V49PS.png" alt="Error: responseText: "></p>
  
  <p>You can see that I've tried several ways of accomplishing it, none worked.
  Can anybody point the mistake/ suggest another solution??? </p>
  
  <p>thanks in advance</p>