asheron's Recent Forum Activity

    To answer my own question, yes.

    To change the content-type in the AJAX plugin, you merely need to edit the AJAX runtime.js file and replace application/x-www-form-urlencoded with the content you need (in my case application/json).

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • I'd like to see this as well. The service I want to post to is expecting application/json content.

    Hmm, the target of my AJAX post is expecting application/json as its content-type.

    It looks like the AJAX post content type in C2 uses application/x-www-form-urlencoded.

    Is this correct? If so, anyway to change the content-type for Post action in the AJAX object?

    Ah, thank you very much. This explains a lot.

    Right, this assumes I was entering the data in the data field itself (which expects a string). The first set of quotes is a requirement of the JSON data format.

    Hello,

    I'm attempting to use the AJAX object to post JSON data.

    The write-up for the AJAX object mentions that the URLEncode system expression should be used for urlencoded content, but is there a similar expression for JSON content?

    If not, any reason manually formatting the data wouldn't work? I understand the double quotes requirement. For example, in the data field:

    {"title":"Hello back at you"}

    would need to be:

    {""title"":""Hello back at you""}

    Thanks for any insights.

asheron's avatar

asheron

Member since 18 Oct, 2012

None one is following asheron yet!

Trophy Case

  • 12-Year Club
  • Email Verified

Progress

13/44
How to earn trophies