title: Jquery conditional button click
body: <p>I have a group of Buttons on my page some I want to make a certain Ajax call and the other buttons a different Ajax call, should I use the data type and put a if statement on that.</p>
  
  <pre><code>$("button").click(function () {
      //SOME BUTTONS AJAX THIS CALL
      //This Ajax toggles device on and off
      var $x10Device = $(this).parent().attr("class");
       $.ajax({
          type: 'GET',
          url: "http://192.168.0.34:81/tenHsServer/tenHsServer.aspx",
          data: {
              t: "ab",
              f: "ToggleDevice",
              d: $x10Device
          },
          error: function (request, status, error) {
              alert(request.responseText);
          }
      });
      //OTHER BUTTONS THIS AJAX CALL
      //This Ajax checks the current on/off status of the passed X10 code
      $.ajax({
          url: "urlencode.php",
          data: data,
          type: "POST",
          success: function (data) {
              myd = $('&lt;span /&gt;').html(data).find("#Result").text();
              console.log(myd);
              if (myd == 'C5:2;') {
                  $('img').attr('src', 'lightbulbon.png')
              } else {
                  $('img').attr('src', 'lightbulboff.png')
              };
          },
          error: function (request, status, error) {
              alert(request.responseText);
          }
      });
  
  });
  </code></pre>