how to resolve VERY LARGE URL problem for hyperlink…with jQuery or Javascript calling any perl,php etc. script on back

StackOverflow https://stackoverflow.com/questions/863966

Question

I have built UI, its like a search engine for BioProcess/Disease--> Genes. e.g., User can query: "Stem Cells" or "brain tumor"and in result it will give 50 to 5000 GeneIDs (essentially those are Numbers representing a uniqe Gene at NCBI database) .

Its free, you can try at : http://proteogenomics.musc.edu/genemesh/

Now, the problem is I am liking those GeneIDs to a NCBI site at once. For upto 200 or 400 GeneIDs I can get result fine. But for more than 500 GeneIDs I can get "URI TOO LARGE" error or somehow NCBI website can not accept huge query. I am trying to resolve this problem.

Can Javascript, OnClick write a file in UNIX /tmp file? or is there any better solution to this?

Any help/guidelines are great at this point...

thank you so much in advance, Saurin

URL too LONG:

http://view.ncbi.nlm.nih.gov/gene/30980,31208,31442,31789,32083,32855,33156,33392,33498,34309,35197,35974,36057,38545,38701,42945,43162,43256,43288,43739,44900,45339,45775,3772082,260437,393632,406845,379537,379620,399306,100037057,100037058,100037249,10,40,43,60,104,133,174,182,185,186,187,197,207,208,210,238,240,269,284,285,317,324,328,332,335,351,355,356,358,361,366,379,387,388,396,429,462,466,472,482,558,567,573,575,576,577,581,595,596,598,604,648,650,664,672,673,675,706,712,754,761,768,771,800,836,841,842,847,857,860,875,885,889,890,891,902,960,970,978,983,999,1000,1018,1019,1021,1025,1026,1027,1029,1030,1031,1051,1082,1111,1116,1124,1131,1152,1231,1234,1272,1282,1284,1285,1286,1287,1288,1316,1432,1457,1459,1462,1464,1471,1474,1485,1490,1493,1499,1508,1512,1520,1543,1545,1571,1594,1600,1605,1612,1620,1622,1630,1633,1638,1641,1643,1649,1728,1755,1756,1803,1809,1814,1839,1854,1869,1909,1910,1942,1950,1956,1969,2012,2013,2014,2019,2020,2022,2034,2035,2044,2045,2046,2048,2050,2051,2052,2064,2066,2067,2068,2071,2100,2149,2166,2173,2246,2247,2250,2251,2254,2260,2263,2264,2272,2289,2290,2305,2308,2309,2321,2335,2475,2542,2547,2574,2579,2621,2627,2670,2734,2735,2736,2737,2738,2740,2849,2890,2896,2901,2908,2925,2932,2936,2939,2944,2947,2950,2952,2956,3073,3074,3082,3090,3091,3104,3105,3106,3115,3122,3123,3146,3161,3162,3181,3191,3215,3240,3265,3309,3315,3324,3371,3373,3383,3384,3397,3398,3417,3479,3480,3481,3482,3485,3486,3487,3491,3553,3558,3561,3565,3566,3569,3574,3575,3596,3597,3598,3603,3611,3621,3630,3632,3645,3672,3685,3688,3717,3732,3738,3741,3766,3785,3791,3814,3815,3845,3897,3910,3912,3913,3915,3918,3925,3945,3956,3958,3981,3987,4035,4087,4088,4089,4133,4137,4145,4147,4152,4155,4172,4175,4192,4193,4194,4241,4255,4267,4288,4292,4303,4312,4313,4314,4316,4318,4320,4321,4323,4327,4350,4436,4440,4524,4548,4549,4552,4574,4601,4609,4654,4684,4691,4735,4745,4763,4771,4790,4804,4807,4808,4829,4830,4843,4851,4856,4893,4907,4914,4915,4916,4950,4978,4982,5015,5028,5030,5054,5080,5111,5118,5154,5155,5156,5159,5178,5241,5243,5266,5274,5276,5290,5294,5295,5328,5329,5334,5340,5395,5444,5468,5536,5538,5563,5566,5578,5579,5580,5581,5583,5584,5591,5594,5595,5599,5602,5629,5653,5663,5702,5708,5713,5725,5727,5728,5730,5743,5745,5747,5764,5781,5803,5805,5834,5835,5879,5880,5881,5888,5894,5898,5899,5900,5915,5921,5925,5934,5970,5978,5981,5992,6048,6091,6118,6165,6195,6275,6278,6284,6347,6382,6387,6416,6464,6469,6490,6502,6506,6507,6513,6598,6606,6608,6622,6647,6648,6649,6657,6659,6660,6662,6663,6664,6667,6670,6678,6695,6697,6714,6717,6770,6772,6774,6790,6853,6855,6863,6892,6900,6948,7012,7013,7015,7018,7020,7025,7040,7042,7054,7057,7076,7078,7105,7124,7153,7157,7161,7168,7175,7185,7186,7248,7249,7258,7262,7276,7277,7283,7298,7422,7428,7431,7442,7447,7468,7474,7490,7508,7515,7517,7518,7520,7525,7545,7799,7849,7852,7980,8028,8038,8061,8089,8140,8190,8301,8372,8484,8507,8577,8605,8650,8678,8682,8692,8718,8737,8741,8742,8743,8745,8754,8771,8772,8788,8795,8797,8811,8828,8829,8841,8842,8848,8851,8862,8871,8877,8928,8930,9077,9100,9113,9141,9148,9156,9173,9211,9212,9232,9334,9353,9423,9429,9444,9445,9447,9459,9507,9518,9535,9545,9588,9681,9806,9833,9844,9961,10036,10135,10209,10215,10313,10362,10371,10381,10401,10472,10512,10530,10572,10620,10630,10642,10743,10763,10776,10855,10893,10991,11009,11010,11013,11065,11093,11095,11096,11141,11156,11162,11186,11191,11200,11235,11284,22865,22933,22943,23136,23152,23162,23209,23261,23308,23336,23435,23469,23627,23654,23705,25776,25792,25855,26013,26038,26050,26136,26256,26471,26524,27122,28514,29103,29108,29126,29997,29998,30001,50618,50859,50943,51050,51147,51199,51213,51230,51305,51330,51335,51438,51637,51668,51747,51763,53358,53615,53616,54106,54828,55210,55294,55553,55717,55752,55760,55859,56647,56920,57124,57142,57447,57448,57670,60672,63827,64101,64386,64710,64805,65065,79659,79682,79944,80309,80332,80381,80781,81557,83483,83605,83667,83858,84148,84189,84280,84504,84525,84631,84654,84707,84708,91419,92140,112755,114798,116448,116986,121227,129787,139065,140885,146691,146956,160728,162979,163732,200895,253260,253738,259266,284217,284459,286527,338030,342945,375790,399473,406907,406991,407043,646555,728239,100133941,403412,396562,396783,751862,100125840,100125841,282862,100008679,11539,11545,11601,11622,11629,11651,11731,11783,11789,11799,11829,11920,11932,12028,12035,12140,12151,12211,12307,12308,12344,12389,12390,12505,12519,12554,12575,12578,12606,12767,12945,13003,13051,13176,13193,13197,13555,13730,13731,13732,13846,13866,14080,14102,14164,14254,14360,14397,14580,14609,14632,14633,14634,14714,14751,14825,14829,14910,15160,15218,15251,15413,15442,15529,15901,16153,16483,16542,16653,16765,16847,17125,17196,17246,17390,17395,17869,17920,18008,18015,18016,18040,18071,18072,18125,18128,18133,18208,18386,18507,18591,18595,18616,18708,18787,18792,18793,18996,18997,19090,19118,19122,19206,19211,19227,19247,19373,19377,19531,19557,19645,19650,19651,20423,20511,20713,20720,20848,20849,20852,20981,21333,21367,21375,21687,21826,21846,21948,22059,22339,22596,22612,23796,26362,26413,26417,26434,30878,30957,50490,50913,50914,54725,55992,56458,56717,60609,64930,66395,66471,67903,71722,74318,75409,76965,79401,81897,83485,107831,110105,110122,111364,111519,170756,192198,210933,211323,216225,218397,230775,232286,239250,245446,245450,269608,386750,24248,24329,24338,24387,24392,24464,24482,24498,24615,24835,24842,24929,25026,25112,25124,25125,25163,25240,25264,25265,25404,25408,25425,25445,25491,25496,25550,25589,25617,25621,25647,25712,29290,29386,29527,29543,29597,29665,50557,50577,50658,50689,54250,54251,59086,64157,64803,65054,81649,81651,81686,83425,83476,83497,83785,84114,84353,84357,84394,84577,84578,89804,89805,89807,114122,114851,116554,116590,116996,117273,170568,192248,292994,297893,306464,308435,338474,360457,362317,369119,2828259,155871,156110,908122,4981003,4981004,4981005,4981006,4981007,4981008,4981009,4981010,4981011,4981012,4981013,4981014,4981015,4981016,4981017,4981018,4981019,4981020,4981021,4981022,4981023,4981024,4981025,4981026,4981027,4981028,4981029,4981030,4981031,4981032,4981033,4981034,4981035,4981036,4981037,4981038,4981039,4981040,4981041,4981042,4981043,4981045,4981046,4981047,4981048,4981049,4981050,4981051,4981052,4981053,4981054,4981055,4981056,4981057,4981058,4981059,4981060,4981061,4981062,4981063,4981064,4981065,4981066,4981067,4981068,4981069,4981070,4981071,4981072,4981073,4981074,4981075,4981076,4981077,4981078,4981079,4981080,4981081,4981082,4981083,4981084,4981085,4981086,4981087,4981088,4981089,4981090,4981091,4981092,4981093,4981094,4981095,4981096,4981097,4981098,4981099,4981100,4981101,4981102,4981103,4981104,4981105,4981106,4981107,4981108,4981109,4981110,4981111,4981112,4981113,4981115,4981116,4981117,4981118,4981119,4981120,4981121,4981125,4981126,4981128,4981129,4981130,4981131,4981132,4981133,4981134,4981135,4981136,4981137,4981138,4981139,4981140,4981141,4981142,4981143,4981144,4981145,4981146,4981147,4981148,4981149,4981150,4981151,4981152,4981153,4981154,4981155,4981157,4981158,4981159,4981160,4981161,4981162,4981163,4981164,4981165,4981166,4981167,4981168,4981169,4981170,4981171,4981172,4981173,4981174,4981175,4981176,4981177,4981178,4981179,4981180,4981181,4981182,4981183,4981184,4981185,4981186,4981187,4981188,4981189,4981190,4981191,4981192,4981193,4981194,4981195,4981196,4981197,4981198,4981199,4981200,4981201,4981202,4981203,4981204,4981205,4981206,4981207,4981208,4981209,4981210,4981211,4981212,4981213,4981214,4981215,4981216,4981217,4981218,4981219,4981220,4981221,4981222,4981223,4981224,4981225,4981226,4981227,4981228,4981229,4981230,4981231,4981232,4981233,4981234,4981235,4981236,4981237,4981238,4981239,4981240,4981241,4981242,4981243,4981244,4981245,4981246,4981247,4981248,4981249,4981250,4981251,4981252,4981253,4981254,4981255,4981256,4981257,4981258,4981259,4981260,4981261,4981262,4981263,4981264,4981265,4981266,4981267,4981268,4981269,4981270,4981271,944996,946069

Was it helpful?

Solution

If you cannot use a cookie, the url is too long. Write the data to a temp table in a database. Once the data is saved out, send back an ID, pass that via the URL. You can do this via a web service call without too much of an issue.

Also, put a timestamp on the table, prune out old data after a set period of time.

OTHER TIPS

You could write them to a cookie, sort of the equivalent of a tmp file. A much better solution would be to POST your data instead of using a GET.

There's some information about URL lengths here: http://www.boutell.com/newfaq/misc/urllength.html

Basically, storing large data in a URL is not advisable.

You might want to consider putting the values into a HIDDEN input control and then having the link post that data to your server.

Basically, instead of doing this:

<A href="http://view.ncbi.nlm.nih.gov/gene/1,2,3,4,5">Link Here</A>

Try doing this:

<FORM action="http://view.ncbi.nlm.nih.gov/gene/" method="post">
    <input type="hidden" id="genes" name="genes">1,2,3,4,5</input>
    <input type="submit" value="Submit" />
</FORM>

Maybe instead of retrieving all the results at once, you could do an AJAX retrieval of the NCBI information for each GeneID when the user clicks on it, adding the results in to the page.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top