Does anyone have a clue to how bit.ly is replacing the textarea as soon as you finish typing the link?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I think that the OP is asking how bit.ly converts the long URL into a shorter URL without reloading the page. This would be done with an AJAX call to a web page, that has a script running on it.
Here is my attempt getting a similar effect on a form submit, I don’t know what aspect is what you are most interested in.
This example has no security, style, or other special stuff, but might give a better idea.
JSON or similar methods are probably used to get data back to JavaScript, which then styles and displays the data. I can’t give specifics of what bit.ly uses, but this is the idea I would use if I tried a similar JavaScript solution.
How did I answer the question? Did I answer something completely different? Should I expand on the answer? Do I ask too many questions? (Yes to the last question)
In response to a comment upon pressing the space bar, that functionality can be added to the above code with the following function.