Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trial
Shaun Kelly
35,560 PointsAjax form submisson
How do i know if a form is being submitted via Ajax?
1 Answer
Steven Parker
243,318 PointsIf your own code is making the AJAX request, you could add a custom data field or custom header to let the server know where the request is coming from.
But if you're only programming the server side, you might provide separate URLs for serving AJAX requests vs. other requests. Still, if someone contacted the wrong URL for the method used, you may not be able to tell.
Dave StSomeWhere
19,870 PointsDave StSomeWhere
19,870 PointsNot sure what you are asking - wouldn't you know if you submitted a form via AJAX since you coded it? Are you wondering about a server side program knowing how something is submitted? Also, just curious as to what you would use this information to accomplish?