Jump to content


Photo

Ajax call error, var example is too long...


  • Please log in to reply
1 reply to this topic

#1 PHP87

PHP87

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 15 October 2013 - 10:34 AM

Hello, i have a strange problem whit a javascript var. Ajax call don't works, because "var data" is too long.

php: $var = json_encode($data); , or also: $var = implode(',', $data); //same problems with both

javascript: var example_var = '<?php echo $var ?>';
        $("#print").click(function(){   
  $.ajax({
      type: "POST",
      url: "example.php",
      data: "example=" + example_var,
      dataType: "html",
      success: function(html) {
        $("#data").html(html);
        }
    });
  });

The example works if i add '$var = substr("$var",0,-500);' in php code, for this i think the problem is var example_var, maybe is too long and the ajax calls don't work. Last: if i see the html source code var example_var is print correctly, but the ajax call don't work.



#2 PHP87

PHP87

    Newbie

  • New Members
  • Pip
  • 8 posts

Posted 17 October 2013 - 12:53 PM

Solved.






0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com