Welcome Guest, Not a member yet? Register   Sign In
using jquery ajax with codeigniter
#21

[eluser]johnpeace[/eluser]
Do it again and show the response this time...or put it on a webserver and send me a URL
#22

[eluser]fatfishy[/eluser]
[quote author="johnpeace" date="1352995167"]Do it again and show the response this time...or put it on a webserver and send me a URL[/quote]

I dont have webserver, anyway this is the response
Code:
<!DOCTYPE html>
&lt;html lang="en"&gt;
&lt;head&gt;
&lt;title&gt;Error&lt;/title&gt;
&lt;style type="text/css"&gt;
...
&lt;/head&gt;
&lt;body&gt;
<div id="container">
  <h1>An Error Was Encountered</h1>
  <p>The action you have requested is not allowed.</p> </div>
&lt;/body&gt;
&lt;/html&gt;
#23

[eluser]benton.snyder[/eluser]
Try to set the following in your application/config/config.php:

Code:
$config['global_xss_filtering'] = FALSE;

Do you receive the same Error Encountered response?
#24

[eluser]fatfishy[/eluser]
[quote author="benton.snyder" date="1352997568"]Try to set the following in your application/config/config.php:

Code:
$config['global_xss_filtering'] = FALSE;

Do you receive the same Error Encountered response?[/quote]
Still 500 error as before :/

Thanks!
#25

[eluser]benton.snyder[/eluser]
Code:
var usernameRequest = $.ajax({
  type: "POST",
  url: "http://127.0.0.1/index.php/ajax/username_taken",
  data: { username:username },
  dataType: 'html'
});

// successful ajax response
usernameRequest.done(function(result) {
alert("Success!");
});

// failed ajax response
usernameRequest.fail(function(jqXHR, textStatus) {
alert("ajax request failed: " + textStatus);
});
#26

[eluser]CroNiX[/eluser]
The only place that error (The action you have requested is not allowed.) comes from is when CSRF protection fails.

So my guess is you have CSRF enabled but are not sending the CSRF name/value in your ajax POST request which would validate that request - so it's being rejected (as it should). Search the forums for how to solve this common problem ("csrf+ajax")

If you use CSRF, everything POSTed needs to have the token name and value passed or it will get rejected. That's it's purpose.
#27

[eluser]fatfishy[/eluser]
[quote author="CroNiX" date="1353011212"]The only place that error (The action you have requested is not allowed.) comes from is when CSRF protection fails.

So my guess is you have CSRF enabled but are not sending the CSRF name/value in your ajax POST request which would validate that request - so it's being rejected (as it should). Search the forums for how to solve this common problem ("csrf+ajax")

If you use CSRF, everything POSTed needs to have the token name and value passed or it will get rejected. That's it's purpose.
[/quote]

that seems to be the problem, I've googled it and I found the solution.
thanks everyone for the help Smile




Theme © iAndrew 2016 - Forum software by © MyBB