Jump to content

*ok, I'll try the question this way*


glennn.php

Recommended Posts

please, someone (anyone), i need to pass a select/option value to a php variable within the same page somehow using onChange. i've tried to find a similar configuration in these forums and netwide, but haven't been able to.

 

should be simple. i just don't know jquery or ajax at ALL:

 

<form id="catform" >
<select id="cat"  onChange="">
		<option>Choose Category</option>
		<option value="Social Life">A Social Life</option>
		<option value="Movies - TV - Music">Movies - TV - Music</option>
</select>			
</form>

<div id="divid">
$cat = "cat selection";
</div>

 

 

p.s. If there's a way to run a function from this same onChange event, that'd be pretty nice, too. I'm figuring to tackle that next.

 

thanks VERY much in advance,

gn

Link to comment
Share on other sites

right, that's what i want to do, but as i said, "i just don't know jquery or ajax at ALL". i'm asking for a little help doing this.

 

i realize that the form value has to leave the page and return via a div, but that's all i know.

 

i don't know jquery. i'm humbly asking for help.

 

gn

Link to comment
Share on other sites

you're asking for me to write the code for you, which I don't feel like doing.. however i will anyway.. :P

 

$(function(){
      $("#cat").change(function(){
      var value = this.value;
      $.ajax({
            url: "url.php",
            data: "value="+value,
            success: function(){alert("success!")}
});
});
});

Link to comment
Share on other sites

i have an ENORMOUS amount of gratitude for the MANY people in forums, and especially this one, from who'm i've learned a GREAT deal about PHP and MySQL, and to whom i can credit my delight in my chosen (and fairly successful) occupation.

 

in return i tell many other people who are attempting to learn of my experiences with most helpful people in these forums, and encourage them to use them. i ALSO gladly offer what assistance i can when there is someone asking for help which i can offer.

 

This is how i've learned more than half of what i know. By someone 'writing the code for me'. i don't just copy and paste and be done with it. I've learned from ALL of it.

 

I also tell these newer and eager persons that there are, occasionally, grouches who for some reason are in here to simply grumble and pretend to help, taking a lot of the joy of this poetry called code out of the whole equation. They seem to want to make it difficult for others who are really here to try to learn something, making others wonder why they're really in here at all.

 

This is what makes me hesitant to want to ask anyone what the heck i'm supposed to do with that code that you so kindly wrote for me. i stuck it in the page in more than one place, and it preformed nothing. i don't know if i'm supposed to use a GET or POST to retrieve my value, because it didn't open a url.php (yes, i created one) for me to SEE what i'm supposed to do.

 

I really am sorry to have bothered you, AK, and i surely hope that you're not too bitter over choosing to do someone else's work for them.

 

I guess i'll go ask for help somewhere else and hope not to bother someone else too much.

 

also, i think your tenses are mixed in your signature.

Link to comment
Share on other sites

I am going to ignore 95% of your post, since I did help you.. the default type is the GET  type, however you can change this by adding the type: setting..

to what you said, you said you learn by looking at code basically.. now the link I provided you with is a link to the jquery ajax API documentation which has absolutely everything that you will need to answer your own question.. however all you wanted was the code.. now to me this demonstrates not someone who wants to learn, rather someone who is too lazy to read and learn by themselves and needs their hand held the entire way.. im done helping you..

Link to comment
Share on other sites

rather, someone who's busy trying to help someone else get a project finished by tomorrow and who doesn't even know where to start reading in all that in the link you sent me, much less have the time (i've spent an entire day trying to find something similar).

 

when i see code work, i see how it works. as i said, i don't just copy and paste and forget about it.

 

you're just a fucking grouch, admit it. the kind of help you offer people have to work around.

Link to comment
Share on other sites

I am going to ignore 95% of your post, since I did help you.. the default type is the GET  type, however you can change this by adding the type: setting..

to what you said, you said you learn by looking at code basically.. now the link I provided you with is a link to the jquery ajax API documentation which has absolutely everything that you will need to answer your own question.. however all you wanted was the code.. now to me this demonstrates not someone who wants to learn, rather someone who is too lazy to read and learn by themselves and needs their hand held the entire way.. im done helping you..

 

and God Bless.

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.