2

I want to send long string with $form.serialize()data as follows.

var $form = $( this ),
url = $form.attr( "action" );
$.ajax({
    url: APP_URL+'/packs/add',
    type: 'POST',
    data: $form.serialize() + '&url=' + JSON.stringify(downloadURL),
    dataType: 'json'
}).done(function(data){

});

The downloadURL is long string and it post half of them and lost the other part. How to post full string?

isuru
  • 3,385
  • 4
  • 27
  • 62

1 Answers1

3

Assuming downloadURL is a string you would have to encode the string with encodeURIComponent

$.ajax({
    url: APP_URL+'/packs/add',
    type: 'POST',
    data: $form.serialize() + '&url=' + encodeURIComponent(downloadURL),
    dataType: 'json'
}).done(function(data){

});
Musa
  • 96,336
  • 17
  • 118
  • 137