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]

  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[split] Ajax library?

#1
i think we must have ajax library.
Reply

#2
My personal experience showed that such class is pointless.
The framework should just support different predefined Response types as: html, text, xml, json.
Example:
PHP Code:
$data = array(1=>'ok');
echo 
Response::json($data); 
Best VPS Hosting : Digital Ocean
Reply

#3
(04-06-2015, 10:14 PM)sv3tli0 Wrote: My personal experience showed that such class is pointless.
The framework should just support different predefined Response types as: html, text, xml, json.
Example:

PHP Code:
$data = array(1=>'ok');
echo 
Response::json($data); 

Yes. That would be nice 
Reply

#4
(04-06-2015, 10:14 PM)sv3tli0 Wrote: My personal experience showed that such class is pointless.
The framework should just support different predefined Response types as: html, text, xml, json.
Example:

PHP Code:
$data = array(1=>'ok');
echo 
Response::json($data); 

+1
Reply

#5
Would be nice if the framework supported RESTful services better out of the box. Like different response types as suggested above and CSRF support for more request types that just POST, as I asked about here http://forum.codeigniter.com/thread-1395.html
Reply

#6
i am really new in CI but i can use jquery ajax and jquery.form, and is enough for me,
ressan.ir
CI is nice Heart
Reply

#7
I think we could add some support for outputting JSON/Ajax

I have extended output.php already (MY_Output.php) to provide a "nocache" method and json method.

Then I only need to use $this->output->json($json); in my controller

For the XML's maybe a $this->output->xml($xml); would be nice?

As for the RESTful stuff I have also extended the router to provide additional REST methods (maybe not the best approach for everyone but it's a idea)

For example

class exampleController extends rest_controller {
public function dosometingAction() {} /* default GET */
public function dosomethingPostAction() {}
public function dosomethingDeleteAction() {}
public function dosomethingPutAction() {}
}

I know the route.php config now supports REST but I'm just not into manually adding 8+ methods for every single controller CRUD = Cx3 Rx1 Ux3 Dx1 minimum .

DMyers
Reply

#8
Controllers should be able to detect request types... including Ajax requests.
Reply

#9
This is a problem for the developer, not the framework.
Reply

#10
(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).
Reply


Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  


  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2020 MyBB Group.