Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

135
Views
$.get cómo agregar encabezados usando laravel

quiero agregar estos encabezados

 headers: { 'Accept': 'application/json', 'Content-Type': 'application/json', },

a mi solicitud $.get jquery

 $('.wilayas').on('change', function(x) { /* $('.dayras').find('option') .remove() .end() */ alert(this.value) $.get("{{ route('customer.auth.dayras') }}", { data: this.value }, function(data, status) { alert(data); $('.dayras').append(` <option value="-">-</option> `); data.map(dd => { $('.dayras').append(` <option value="${dd.id}">${dd.dayra}</option> `); }) }); });

estoy recibiendo la respuesta html en lugar de json

about 4 years ago · Juan Pablo Isaza
1 answers
Answer question

0

La sintaxis de la opción de headers jQuery ajax:

 $.ajax({ headers: { "Accept": "text/json" "Content-Type": "application/json" } ... ... });

La sintaxis de la opción de headers jQuery ajax establecida o sobrescrita con la función de devolución de llamada beforeSend :

 $.ajax({ url: "{{ route('customer.auth.dayras') }}", data: { foo: bar }, type: "GET", beforeSend: function (jqXHR, settings) { jqXHR.setRequestHeader("Accept", "text/json"); jqXHR.setRequestHeader("Content-Type", "application/json"); } ... ... });
about 4 years ago · Juan Pablo Isaza Report
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!