codefossa Posted February 26, 2011 Share Posted February 26, 2011 So, what I'm trying to accomplish is basically putting the results of a .load() into a variable. This way I could use the variable to set a text field value to the results of the load. Is this possible, or would I have to use .load() into a hidden div and get the html of the div as the variable? Quote Link to comment https://forums.phpfreaks.com/topic/228874-jquery-load-in-val/ Share on other sites More sharing options...
haku Posted February 26, 2011 Share Posted February 26, 2011 Load only loads into an HTML element, not a variable. And putting it in a hidden div is not a good way to do it. Instead you should use $.ajax or $.post or $.get. Quote Link to comment https://forums.phpfreaks.com/topic/228874-jquery-load-in-val/#findComment-1179863 Share on other sites More sharing options...
codefossa Posted February 26, 2011 Author Share Posted February 26, 2011 I don't see how that'd help, since I'm tryin' to load like 2 words from another page into a text field upon pressing tab. This is for my chat, and I want it to automatically type "/msg {USER} " for the last person that sent you a PM upon pressing {TAB}. I figured, since it will change constantly, that loading it from a separate page that can run the query would be the best bet, rather than a refresh to update who messaged you last. Also, when I tried using a hidden div, it went too fast and would fill the div, but then the html of the div wouldn't be picked up on the first time 'round, which means they would be one behind everytime they used the hotkey. Maybe I would be better off just leavin' this option out .. Quote Link to comment https://forums.phpfreaks.com/topic/228874-jquery-load-in-val/#findComment-1179865 Share on other sites More sharing options...
haku Posted February 26, 2011 Share Posted February 26, 2011 Basically it comes down to this. If you want to get dynamic content and load it into the page right away upon download, use load(). If you want to get dynamic content and not use it right away (i.e. put it into a variable), use one of the three functions I gave you. Quote Link to comment https://forums.phpfreaks.com/topic/228874-jquery-load-in-val/#findComment-1179889 Share on other sites More sharing options...
codefossa Posted February 26, 2011 Author Share Posted February 26, 2011 Sorry about that, I'm just new to JQuery and didn't fully comprehend what you were talking about. I have searched what you said on Google and was able to figure it out. Thanks a ton for your help, it worked great. Quote Link to comment https://forums.phpfreaks.com/topic/228874-jquery-load-in-val/#findComment-1179938 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.