title: Passing jQuery variables to Controller via AJAX
body: <p>I am trying to send the variables from the GetTelephoneFunction to the AJAX query so it can reach the controller, but what I have tried does not work. Please help and thank you.</p>
  
  <p>jQuery:</p>
  
  <pre><code>$.ajax({
          type: "POST",
          url: "/Status/GetUrlSource",
          contentType: "application/json; charset=utf-8",
          data: JSON.stringify({ "url": $("#urlInput").val(), "user": $("#user").val(), "pass":$("#pass").val(),"freq": $("#freqInput").val() }),
          dataType: "html",
          success: function (result, status, xhr) {
          //Code
          }
      function GetUrlTelePhone(html, status, result) {
          var geturlUser = url.split('?username=')[1].split('&amp;password')[0];
          var geturlPass = url.split("&amp;password=")[1];
          var getUrlMain = url.split("?")[0];
          var geturlParameters = url.split("aspx")[1];
          }
  </code></pre>
  
  <p>Controller</p>
  
  <pre><code>    public string GetUrlSource(string url, string freq, string user, string pass)
      {
          //user = user.Substring(0, 10) != "?" ? "?" + user : user;
          //pass = pass.Substring(0,20) != "&amp;" ? "&amp;" + pass : pass;
          url = url.Substring(0, 4) != "http" ? "http://" + url : url;
          string htmlCode = "";
          using (WebClient client = new WebClient())
          {
              try
              {
                  htmlCode = client.DownloadString(url);
              }
              catch (Exception)
              {
                  return "Not Found";
              }
          }
          //SqlConnect(url);
          Hangfire(url,freq,user,pass);
  
          return htmlCode;
  
      }
  </code></pre>