ajax - $_POST value not complete in php file -


he guyz,

i confused because of happening form values.

at first created simple html form, of convert values string. below part of code in document.ready

 var fbid = $("#fbid").val();     var name = $("#name").val();     var address1 = $("#address1").val();     var address2 = $("#address2").val();     var city = $("#city").val();     var postal = $("#postal").val();     var countries = $("#countries").val();     var datastring = 'fbid=' + fbid + '&name=' + name + '&address1=' + address1 + '&address2=' + address2 + '&city=' + city + '&postal=' + postal + '&countries=' + countries 

so far good. use following code upload php file in order insert data database

            $.ajax({             type: "post",             url: "*http://www.url.com/file.php*",             data: datastring,             cache: false,             success: function (result) {                 alert(result);             }         }); 

now somehow, last value giving problems. select input puts first 5 characters in database. when tried text input, shows 3 characters(which thought weird). tried debug , find problem was:

  • changing order of string (last , second last value) resulted in second last value not displaying correctly (so countries posted succesfully(also weird:p)
  • i deleted content in php file , replaced with

$countries=$_post['countries']; echo "$countries";

this resulted in, also, first 5 characters displayed

  1. i used console.log view string , here full content displayed

so looks goes wrong in between sending string , php file receiving it

i have know idea going wrong here. love have spend best part of week on now!

bye, chris

since when swapped fields, countries value got inserted correctly, second last value truncated. means somehow hitting limit in terms of data post.

while highly unlikely, want test well. try following:

  1. make regular post, without ajax , check if data getting posted correctly. if no, have incorrect post_max_size set in apache config or htaccess.

  2. if test above works, regular post fine , has ajax. ensure data not going url param (looking @ code should not). first post each values individually see if going through.

with results of these tests should able discern problem is. code fine, feel must configs.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

How to get the ip address of VM and use it to configure SSH connection dynamically in Ansible -

javascript - Get parameter of GET request -