Make an httprequest call with Curl

Asked

Viewed 85 times

0

I have a url of an api that returns me 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 make an httprequest in which I used Curl and then json_decode. I do not know if I made myself understood , I hope so and help me , thanks

  • If you don’t understand I’ll try to explain it better, thank you

1 answer

0


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

$(".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>
<div class="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>

  • Thank you very much :)

  • And is it possible that when multiple selection opens the dropdown with the options ? Thank you

  • I don’t know if it’s possible. I even opened a question if you want to keep up: https://answall.com/questions/275504/expandingoptions

  • yes I am, thank you

Browser other questions tagged

You are not signed in. Login or sign up in order to post.