views:

30

answers:

1

I am using jquery datatables to display data from a mysql database. When you click on a row, a jquery ui dialog box opens with a form for the data, and buttons to update or delete the entry. The code for the update button uses serialize to send the data to a PHP script, like this:

buttons:{ 
   "Update": function() { 
    $("#result p").load("update_data.php?" + $('form').serialize(), 

The problem I am having is that one of the fields in the database is for body text, and is potentially very large. This is causing the form not being submitted in some cases. I realise that I can increase the value for the Apache configuration setting LimitRequestFieldsize, but unfortunately I am not able to make changes to the Apache config due to issues outside my control. Is there some way I can fix this? Is there a better way to send data to the server than the method used above?

+3  A: 

james,

you might be better to $post that data, as there's a chance that you're actually sending it as a get request (which can be dangerous on a few security levels). the $ajax object may be a better vehicle which would then update your $("#result p") div on success.

have a wander thro this :

http://api.jquery.com/jQuery.ajax/

the basic 'pattern' is:

$.ajax({
  url: 'ajax/test.html',
  success: function(data) {
    $('.result').html(data);
    alert('Load was performed.');
  }
});

which isn't 'too' far from your own intentions. (just make sure that your php function looks for $_POST variables, rather than $_GET ones if you adopt this method).

just a thought..

jim
Excellent, thanks. That looks like a good solution.
james.bcn
james, let me know it it works out ok!!
jim
This method worked, thanks jim!
james.bcn