Reputation: 9407
<a href="javascript:change('page_details_1','time,restime\n1387519869249,1196\n1387519906965,1368\n........')><img src="expand.jpg" alt="expand/collapse" id="page_details_1_image"></a>
in href i am calling a javascript function "change". The second parameter "\n1387519869249,1196\n1387519906965,1368\n...." is a very long value about 5070 characters.but at 5052 characters the link works.
Is there a limit to number of characters that can pass through href? the data is used to generate trend graph . If there is such a limitation what would be the best way to pass such info to javascript function?
Upvotes: 2
Views: 1912
Reputation: 33578
Try
<a href="javascript:void(0);" onclick="change('page_details_1','time,restime\n......'); return false;"><img src="expand.jpg" alt="expand/collapse" id="page_details_1_image"></a>
This way your URL isn't overly long.
Upvotes: 1
Reputation: 770
Why not save the long term into a variable
value = "yes";
<a href="javascript:alert(value)">blubb</a>
Upvotes: 0
Reputation: 391
Here's a great article on passing data with JSON. I'm using PHP and it's much easier than I thought :) http://betterexplained.com/articles/using-json-to-exchange-data/
Upvotes: 0
Reputation: 6854
The maximum limit of an href link is 2000: https://stackoverflow.com/a/417184/2413722.
If it's just data that you are wanting to send, then add a data attribute and get JavaScript to read that value (this is simplified somewhat in jQuery).
Upvotes: 0