Make an httprequest call with cURL

0

I have an api url that returns a json, and I wanted to make a request for the information to be updated, and then decoded through json_decode, so I know I would have to do an httprequest where I used cURL and then json_decode . I do not know if I understood myself, I hope so and that they help me, thank you

    
asked by anonymous 09.02.2018 / 15:36

1 answer

0

You can use .html () for this, you just get the value with each change in the checkbox of the classes of bet and type and assign the checked checkbox value to the column of the desired ticket table:

$(".cb").change(function(){
    $(".cb").prop('checked',false);
    $(this).prop('checked',true);
    $("#aposta").html($(this).val());
});


$(".chb").change(function(){
    $(".chb").prop('checked',false);
    $(this).prop('checked',true);
    if($(this).val() == "myselect"){
      $("#tipo").html($("#myselect").val());
    }else{
      $("#tipo").html($(this).val());
    }
});
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.1.1/jquery.min.js"></script><divclass="col-md-9">
  <form>
      <label class="checkbox-inline">
       <input type="checkbox" name="cb4" class="chb" value="Simples (de 1 a 8)" />Simples (de 1 a 8)
      </label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="chb" value="Combinada (de 2 a 8)" />Combinada (de 2 a 8)
      </label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="chb" value="myselect" />
        <select id="myselect" class="chb" style= "width: 90px;">
          <option value="Múltipla">Múltipla</option>
          <option value="2/3 combinações">2/3 combinações</option>
          <option value="2/4 combinações">2/4 combinações</option>
          <option value="2/5 combinações">2/5 combinações</option>
          <option value="3/4 combinações">3/4 combinações</option>
          <option value="3/5 combinações">3/5 combinações</option>
          <option value="4/5 combinações">4/5 combinações</option>
          </select>
      </label>
      <script>
      $(".chb").change(function()
                {
                    $(".chb").prop('checked',false);
                    $(this).prop('checked',true);
                });
      </script>
  </form>
  </div>    
  <div class="col-md-2">
  </div>
  </div>
  <div class="row">
  <div class="col-md-1">
  </div>
  <div class="col-md-9">
  <form>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="1€" />1€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb"  value="2€"/>2€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="5€" />5€</label>
      <label class="checkbox-inline">
       <input type="checkbox" name="cb4" class="cb" value="10€" />10€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="20€" />20€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="50€" />50€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="75€"/>75€</label>
      <label class="checkbox-inline">
        <input type="checkbox" name="cb4" class="cb" value="100€" />100€</label>
  </form>
</div>
<br />
<div class="panel-footer panel-primary ticketFooterTour">
  <table class="table table-condensed text-center" border="1">
      <tbody>
          <tr>
            <th class="text-center">Tipo</th>
            <th class="text-center">Odd</th>
            <th class="text-center">Aposta</th>
            <th class="text-center">Total</th>
            <th class="text-center">Resultado</th>
          </tr>
          <tr>
            <td class="text-center" id="tipo"></td>
            <td class="text-center"></td>
            <td class="text-center" id="aposta"></td>
            <td class="text-center"></td>
            <td class="text-center"></td>
          </tr>
       </tbody>
   </table>
 </div>
    
09.02.2018 / 16:18