Split the string up into chunks
var chunkStr = function(str, chunkLength) {
// Split at the end of a tag
return str.match(new RegExp('.{1,' + +chunkLength + '}', 'g'));
}
var newstring = chunkStr( oldstring, 128 );
Question
$('#participate').click(function(){
var content = $('#item-content-text').html();
VK.api('wall.post',{ message: content}, function(data) {
if (data.response) { // если получен ответ
//message send
}
else{
// error
}
});
})
So I'am clicking on a button an then I get some page html content, the question is:
How can I send many html content Via GET, maybe is there an option by sending content by loop, but how to do that?
i think something like this:
for(var i = 0; i < content_array.length; i++){
VK.api('wall.post',{ message: content_array[i]}, function(data) {
if (data.response) { // если получен ответ
//part of html sended
}
else{
// error
}
});
}
but how to split a big html content by parts?
PS: if someone know the (API VK) that there are no options to send that data Via POST, thats is why I'am using GET...
Solution
Split the string up into chunks
var chunkStr = function(str, chunkLength) {
// Split at the end of a tag
return str.match(new RegExp('.{1,' + +chunkLength + '}', 'g'));
}
var newstring = chunkStr( oldstring, 128 );