encodeURIcomponent fails the first time (need two clicks to work)
var param ="&usuario="+usuario+"&nivel="+nivel+gano+porc_gano+gasto+porc_gasto+tengo+porc_tengo+debo+porc_debo+plazo_debo;
var s = document.createElement("script");
s.src = direccion_servidor +"setMisDatos?callback=respuestaGuardarMisDatos¶m="+encodeURIComponent(param);
h = document.getElementsByTagName("script");
i got the parentNode.insertBefore code from google (the same they use in google analitycs), but still i get error (specifically when he has to do the parentNode.insertBefore part (earlier it was only appendChild, but used to give me the same kind of error. Are the spaces a problem in this sense? Or there might be a better solution? because if i click the second time it enters the setMisDatos function and then works 100%. This is really driving me crazy, can anybody help me?
i tried it, but it still doesn't work.. in the netbeans logger, it actually works only if it can enter the setMisDatos function, while when it doesn't work, nothing appears on the logger (making me think that the function is not called). any suggestion?
i even tried changing the encodeURIcomponent with encodeURI, but it still creates problem, what i thinkis that if it doesn't work the first time but then always, i don't believe there is something incorrect with the variables no?
isn't there a tool to help me check the error better than firefox or chrome web console?