It just worked another way.
My friend created a script that saves the ID of the individual posts:
(function(){
var numbers = document.URL.match(/\d+/g);
if(numbers != null){
$('#right-col').addClass('shown').removeClass('hidden');
$('#left-col').addClass('colPositioning');
$('#right_'+numbers).addClass('shown1');
;}
}());
Afterwards I was able to use:
<a href="https://twitter.com/share?url=my_url/%23/?p=<?php the_id();?>" class="twitter-share-button" target="_blank"><img src="img_src"></a>
The trick about it was to replace the # with the "%23". I think it's called encodedURI.
What do you guys think about this solution?