question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

POST not getting data but $.ajax does.

See original GitHub issue

Maybe this is the problem with my understanding of Vue resource, but why does this work:

_this = this;

            $.ajax({
                type: 'POST',
                url: requestURL,
                async: false,
                success: function (data) {
                    _this.$set('cartData', data);
                }
            });

But this does not:

this.$http.post(requestURL).then(function(response){
        this.$set('cartData', data);
})

I get a “Headers already sent error”. Backend for this example is Symfony 2.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5

github_iconTop GitHub Comments

1reaction
ivandoriccommented, Dec 23, 2016

@evertramos I think I did, but it was a long time ago. the project is finished, so I can’t check it now. But thanks for the suggestion.

1reaction
evertramoscommented, Dec 22, 2016

Have you tried a simple:

this.cartData = data;

Read more comments on GitHub >

github_iconTop Results From Across the Web

jQuery AJAX/POST not sending data to PHP - Stack Overflow
You need to set the data type as json in ajax call. JQUERY CODE: $.ajax({ url: "ajax/add-user.php", type: "POST", dataType:'json', ...
Read more >
jQuery $.ajax({}) not sending my POST data to server - Reddit
Hello everyone. I'm having a noobish issue with sending some stringified JSON back to my server. The code in question is this: var...
Read more >
jquery ajax with passing data not working - ExpressionEngine
Code looks fine from what I can tell, no obvious problems. Can you use Firebug or something to inspect the request and make...
Read more >
AJAX post request not posting all data - Forums - Liferay
Hi, I'm trying to do an AJAX post request in a portlet in Liferay 6.2. The URL is correct because I am getting...
Read more >
jQuery AJAX POST Tutorial - AirPair
Let's break down the not-so-clear parts of the $.ajax() method. The dataType setting controls how data we receive from the server is treated....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found