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

96
Views
Ajax GET Request inside ajax post request?

Is it possible to make an ajax request inside another ajax request? because I need some data from first ajax request to make the next ajax request.

I tried to make a script, but i see that instead of GET, my request is POST and i dont know where is the problem..

<script type="text/javascript">
    $.ajaxSetup({
        headers: {
            'X-CSRF-TOKEN': $('meta[name="csrf-token"]').attr('content')

        }
    });
    $('#file-upload').submit(function(e) {
        e.preventDefault();
        let formData = new FormData(this);
        $('#file-input-error').text('');
        $.ajax({
            type: 'POST',
            url: "{{ route('resume.store') }}",
            data: formData,
            contentType: false,
            processData: false,
            success: (response) => {
                if (response) {
                    this.reset();
                    $("#showResponseArea span").html(response); //you will paste your response msg to the 
                    $.ajax({
                        type: 'GET',
                        url: "{{ route('resume.api') }}",
                        dataType: 'json',
                        data: {
                            'url': response,
                        }
                    })
                }
            },
            error: function(response) {
                $('#file-input-error').text(response.responseJSON.message);
            }
        });
    });
</script>

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

0

My code works perfectly, the real problem was in the controller, instead of:

public function fetch(Request $request)
{
    $cvupload = $request->url;
    $client = new Client();
    $res = $client->get("https://api.apilayer.com/resume_parser/url?url=$cvupload", [
        'headers' => [
            'apiKey' => 'xxx'
        ]
    ]);

my code was with $res = $client->post.

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!