Angular, JSONP & FormStack

Hey, everyone!

So I’ve run into a bit of a roadblock as I build out a small Angular app for a Christmas initiative we’re doing.

One of the components is allowing people to submit a story, so - to keep life a bit simpler - I thought I’d just use a FormStack. We use them for lots of things, but this would be the first time trying to use their API.

Their API seems straight-forward enough, nothing too crazy, so I start to build the app, get everything working as I want it to and test with a local JSON response. We’re all good.

Then I try to make the call to FormStack’s API. Using the examples and generated API call, I test it in my browser. I can navigate to the JSON response just fine, so I try to use $http.jsonp, knowing that it will be a cross-platform response:

$http.jsonp(url, { jsonCallbackParam: 'callback' }).then(...)

That’s when I run into trouble. Either I’m doing something incorrectly or FormStack is sending back an improper response. The browser throws a Syntax error because it’s looking for a JSONP response, but it’s getting a pure JSON response. Essentially, the response is not being wrapped in a JavaScript function as expected.

So, I thought I’d try just $http.get(…), but that doesn’t work either. Then I get no response, which makes sense.

Am I missing something here? I’m not really sure what else to try, unless the issue is on their end and not mine?

Is there a way to “trick” Angular to be okay with a plain JSON response. I think I know a trick to do that in jQuery, but I’m trying to avoid that, if possible.

Thanks!

-Eric

Sent a PM about things to try and attack the problem differently.

Thanks, @robertleelarson. Unless I’m missing it, I haven’t gotten a PM, though. No rush. I know things pop up, but since this is a new platform, just wanted to make sure I wasn’t missing something.

Thanks again!

-Eric

check your slack account for the PM. My apologies for not specifying where :smiley:

Oh! Haha… okay. :slight_smile: