![]() |
![]() |
![]() |
||||
Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums. You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today! If you have any problems with the registration process or your account login, please contact us. |
![]() ![]() |
|
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed. |
|
Thread Tools |
![]() |
#1 | |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ajax wizards in here
Ok so I was using the GET method up until I realized I can't send paragraphs of textarea data, so I converted it to POST, but it's still cutting my paragraphs off??
Sorry this doesn't paste well here. Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#2 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Posts: 5,594
|
![]() |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#3 |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
jQuery man, jQuery ;)
The sooner you start using it, the sooner the headaches disappear.
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#4 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Son of a bitch.
What's jquery got to do with this though? That shit looks way out of wack, like my headaches would disappear and migraines begin lol. I see a lot of people in google have found the solution by converting to POST, but mine isn't working. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#5 |
..I Heart Cannibal Corpse
Industry Role:
Join Date: Sep 2007
Location: California
Posts: 4,328
|
...or dreamweaver CS4, integrates ajax beautifully
__________________
... |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#7 |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Didn't test it at all... and you need to load the jquery libraries.
Code:
Jquery: <script type="text/javascript"> $("#isLoading").hide(); $(document).ready( function(keyPage, jsNum, aNum) { $("#isLoading").show(); $.post("/PHP_FILE_TO_CALL.php", { delimiter: $("#delimiter").val(), dump: $("#dump").val() }, function(response){ $("#ajaxCol"+jsNum).html(unescape(response)); }); $("#isLoading").hide(); }); }; </script> Then just do like in the html: <span id="isLoading"><img src=ajax.gif></span> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#8 |
Confirmed User
Industry Role:
Join Date: Dec 2003
Location: City... City of Satan
Posts: 2,651
|
It's already been said and solved, but jq is the way to go forsure. There are some nice new ajax features in the newest version (1.4).
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#9 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Best. Forum. Evar.
Is it safe to load the libraries from Google? Hopefully they aren't changing the paths any time soon.. Edit: fuck, need your own API key to load from Google? This jquery shit is looking to be too much of a hassle, if other people are going to be using this then they're going to have to have these libraries installed and shit? Do most servers have this already? |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#10 |
Confirmed User
Industry Role:
Join Date: Aug 2009
Location: me at smellynose.com
Posts: 206
|
jQuery is amazing - Use it immediately!
![]() Get jQuery from jquery.com, don't include it from Google.
__________________
I'm a PHP developer - 594086663 - [email protected] |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#11 | |
Too lazy to set a custom title
Industry Role:
Join Date: Aug 2002
Posts: 55,372
|
Quote:
just direct link to the library, or direct link to it off of jquery.com http://jet.li/twitter/ this is something i did that uses some jquery to load via search.
__________________
Since 1999: 69 Adult Industry awards for Best Hosting Company and professional excellence. ![]() WP Stuff |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#12 |
Confirmed User
Join Date: Jun 2009
Location: Asheville, NC
Posts: 2,277
|
Or Prototype :P I'm a big fan of being able to create classes... although I will admit jQuery is pulling ahead in the race. If jQuery UI wasn't so bloated I'd consider switching faster.
__________________
ICQ: 258-202-811 | Email: eric{at}bestxxxporn.com |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#13 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
I don't see any good reasons not to load from Google. People are most likely going to have it cached already..
This jQuery shit is fucking UGLY man.. why does it have to look like this wtf lol. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#14 | |
Confirmed User
Join Date: Apr 2002
Location: Houston
Posts: 5,651
|
Quote:
i think my code is way more sexy then what you originally posted.... ![]() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#15 |
Confirmed User
Join Date: Oct 2003
Location: Command Central, West Palm Beach, Fl
Posts: 1,794
|
I have to agree, Alky's code was way more sexy. Just use jquery, and be a happy camper.
__________________
I do stuff - aIm CS_Jay_D |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#16 | ||
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ok I'm reading a bunch of stuff trying to figure all this jQuery mess out. Even though most of the tutorials online expect you to know a ton of shit already, but first..
How do I even call what you gave me within my HTML form? There's the Quote:
Should I remove the .hide()'s and use something like Quote:
|
||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#19 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Who the hell is that? Is it supposed to be some kind of jheri curl - jquery joke? lol
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#20 | |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
Quote:
If it's a form submit and the div is to show based on submit response, why not use jQuery thickbox. There's got to be one of those examples that fits your needs (scroll down to the last AJAX example)? And damn simple to boot.
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#21 | |
Totally Borked
Industry Role:
Join Date: Feb 2005
Posts: 6,284
|
Quote:
![]()
__________________
![]() For coding work - hit me up on andy // borkedcoder // com (consider figuring out the email as test #1) All models are wrong, but some are useful. George E.P. Box. p202 |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#22 | |||
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ok I managed to get something extremely simplified so that even I can understand it and someone can hopefully understand what I'm trying to do lol. Only one problem I have. I want the jQuery to just display whatever the PHP sends back to it, instead of having to go through all the json crap and having the jQuery handle what gets shown. Ex (I use tabs so the indents are gone sry):
The js/jquery: Quote:
Quote:
Quote:
$return_json = "{'delimiter':'".$_POST['delimiter']."'}"; and make it send all the HTML/etc I want to display? Like: $everything="<b>blah blah blah ".$_POST['delimiter']."</b>"; $return_json = "{'everything':'$everything'}"; Edit: it works^ I guess I will just do it that way, but idk if it's the wrong way or it doesn't matter or what. I just don't want to handle all the printing and HTML in jquery because it's really going to clutter a lot of shit up. And having to rename all the $_POST's is just stupid imo I don't really understand the whole json thing. |
|||
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#23 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
You don't have to use json
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#24 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ok I replaced the <input> field with a textarea and it won't print anything if I have more than 1 line of text inside the textarea... what the faaaaaaack!
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#25 | |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
below is your function changed to return html
Code:
$.post("ajaxwork.php?a=import_videos", $("#target").serialize(), function(data){ $("#ajaxCol"+jsNum).html(data); }, "html"); Quote:
Code:
echo htmlentities($return_json); |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#26 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Changing the json to html makes it show nothing, no matter what I try to pass to it..
Edit: json_encode() seems to do the trick. Edit 2: Well I finally got it to work with the multiple textarea lines, but now I'm back to the original problem where ajax wouldn't POST a large paragraph of text, and this jquery is passing even less text through, this is ridiculous.. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#27 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Ok it's only returning a limited amount of text because of ' (single quotes) within the text.
I already have json_encode(nl2br($_POST['text_dump'])) what else? htmlentities and htmlspecialchars aren't helping. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#28 |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Here we go
json_encode(nl2br(str_replace("'","& #39;",$_POST['text_dump']))) I just wanted to be able to send an FLV dump of text via ajax and I had to go through all this crap lol. |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#29 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
I made you an example...
http://lifestyleamateurs.com/test.php this is the php script I am posting to. Code:
<?php $galleries = preg_split("/\r?\n|\r/", $_POST['textarea']); foreach($galleries as $gallery) { list($url, $description) = explode('|', $gallery); echo "<a href='{$url}'>{$description}</a><br>\n"; } ?> |
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#31 | |
Confirmed User
Join Date: Feb 2002
Location: ICQ: 251425 Fr/Au/Ca
Posts: 6,863
|
Quote:
Your server doesn't have magic_quote or some abomination on does it ? If you're looking to secure text for a database insert, mysql_real_escape_string() |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#32 |
Confirmed User
Industry Role:
Join Date: Aug 2006
Posts: 5,594
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#33 |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#35 | |
Confirmed User
Industry Role:
Join Date: Jan 2004
Location: oddfuturewolfgangkillthemall!!!!!!!
Posts: 5,656
|
Quote:
And yeah certifiedhosting did have magic quotes on, just turned it off. I also installed firebug a couple days ago but haven't restarted firefox yet since I have like 30 damn tabs open. Thanks a million, hopefully I won't have to come back here and 'bug' ya'll again lol. |
|
![]() |
![]() ![]() ![]() ![]() ![]() |
![]() |
#36 | |
Confirmed User
Industry Role:
Join Date: Mar 2004
Location: Rock Hill, SC
Posts: 5,370
|
Quote:
|
|
![]() |
![]() ![]() ![]() ![]() ![]() |