Jump to content


Clear selected option value if another one is selected


  • Please log in to reply
1 reply to this topic

#1 rx3mer

  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts
  • LocationUK

Posted 30 March 2014 - 07:29 PM

Hi guys,


I have a select option list with different values that come from MYSQL. 1,2,3,4,5,6 etc...

Basically when I select one, and then change my mind and select another option from the list 2 of the values are stored and parsed to my ajax.


I tried different methods such as empty(); inside the optionbox on click but nothing seems to reset it.


	 var CASE_ID =  $(this).attr('playlistID');
	      data:'playlistID=' + CASE_ID,
	      success:function(data) {
	        if(data) {   // DO SOMETHING

	        } else { // DO SOMETHING 



Basically all i want is the last selected value to be passed to the invite on click.


Any suggestions?



Website Design

#2 denno020

  • Members
  • PipPipPip
  • Advanced Member
  • 747 posts
  • LocationAustralia

Posted 17 April 2014 - 12:30 PM

Do you see both of the ID's on the server? Or are you just going by what's displayed in your console?


Every time you 'change your mind', and select a different option, your console.log will run, which is why you're seeing both 2 and 10.


Move your console.log call into the .invite click function, and that will be the value that was sent to the server, as it will only be execute when you effectively execute the ajax.


Hope that helps


0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users