Welcome Guest, Not a member yet? Register   Sign In
Poll: Ajax library?
You do not have permission to vote in this poll.
yes
36.73%
18 36.73%
no
51.02%
25 51.02%
maybe
12.24%
6 12.24%
Total 49 vote(s) 100%
* You voted for this item. [Show Results]

[split] Ajax library?
#11

(04-14-2015, 09:44 AM)mwhitney Wrote:
(04-10-2015, 05:05 PM)blocSonic Wrote: Controllers should be able to detect request types... including Ajax requests.

How do you suggest the controller detect an AJAX request? HTTP_X_REQUESTED_WITH (the server variable checked by $this->input->is_ajax_request()) represents a non-standard header sent (or not) by the client to indicate an AJAX request, but (especially as a non-standard header), there is no requirement for that header to be present alongside an AJAX request.

From the server's perspective, there is otherwise no difference between an AJAX request or a normal request. For this reason, it's largely up to the developer to create a good API for their site and stick to it. If someone sends a non-AJAX request to a method which was designed to only handle AJAX requests, they should be expected to handle the returned data correctly, rather than expecting the server to detect that they didn't use an XmlHttpRequest (and spelling that out brings up the point that the correct return type for an AJAX request isn't set in stone, either).

The same way other frameworks do. I can't tell you what it is they do to determine it, but they do. It's not unrealistic to expect a framework to provide this ability.
Reply


Messages In This Thread
[split] Ajax library? - by paysalkharis - 04-06-2015, 09:19 PM
RE: [split] Ajax library? - by sv3tli0 - 04-06-2015, 10:14 PM
RE: [split] Ajax library? - by albertleao - 04-06-2015, 10:52 PM
RE: [split] Ajax library? - by salain - 04-06-2015, 11:23 PM
RE: [split] Ajax library? - by silentium - 04-06-2015, 11:37 PM
RE: [split] Ajax library? - by nasser.man - 04-07-2015, 12:11 AM
RE: [split] Ajax library? - by dmyers - 04-08-2015, 05:52 AM
RE: [split] Ajax library? - by blocSonic - 04-10-2015, 05:05 PM
RE: [split] Ajax library? - by mwhitney - 04-14-2015, 09:44 AM
RE: [split] Ajax library? - by blocSonic - 04-14-2015, 06:40 PM
RE: [split] Ajax library? - by mwhitney - 04-16-2015, 06:49 AM
RE: [split] Ajax library? - by albert.freeman - 04-13-2015, 03:34 PM
RE: [split] Ajax library? - by sv3tli0 - 04-14-2015, 11:42 PM
RE: [split] Ajax library? - by Razican - 04-20-2015, 03:39 AM
RE: [split] Ajax library? - by PaulD - 04-20-2015, 07:04 AM



Theme © iAndrew 2016 - Forum software by © MyBB