• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
URL limitation?


I have weird problem. 

I have "Ajax.php" controller for handling ajax requests. 

Some URL not working for me and I don't know why.

  url: ajaxurl + 'add_combined_booking',

This will call /ajax/add_combined_booking method (POST). This works fine.

  url: ajaxurl + 'delete_combined_booking',

This is not working. 

Difference is in method - "add_combined_booking" works but "delete_combined_booking" not working. 

Please, can somebody tell me why? Is there some limitation in URL method length?

error: function (xhr, ajaxOptions, thrownError) {

Use the above to find out what's wrong.
Simpler is always better

Thanx, but there are no errors in my ajax request. Even if I access url directly: /ajax/delete_combined_booking there are no error, no errors in log, no error 500, nothing. Even no error in webserver error log.

There's no built-in limits on URL length, so it's not that.

Is your route setup correctly to recognize the other URL? Does the controller method exist to match up with it? Hard to say why it's not working without additional details.
Support Development  • Practical CodeIgniter 3  •
Myth:AuthVulcan - CLI Tools for CI4

URL length is not the problem. The HTTP protocol does not define any limit on the length. Some browsers may implement a limit, but those tend to be around the 2000 mark.

The problem is most likely either the URL is not found or the function isn't returning a useable value. I would expect the first case to produce an ajax error.

Have you used your browser's "web developer" tool to check that the delete method is actually reached? If it is reached, then what, if anything, it does it send in reply? You might want to comment out the code for the desired work and just echo back a string. Use the js console to see if that string is the reply.

As pointed out - check the developer tools in your browser. CORS is what comes to my mind and possibly what HTTP method is used for the delete request.
I have just completed a project using CI 4.0-rc3 heavily using Ajax-based API with manually routing setup and it works like a charm. You need to take care setting up all the routes, but such problems are easy to find using the browser's developer tools.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

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