2 Replies - 2934 Views - Last Post: 26 January 2013 - 04:10 PM

#1 Joshdw  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 23-March 09

jQuery Slider GET Value

Posted 26 January 2013 - 12:11 PM

Heh, heya once again guys!
I am stuck once again.. I have no idea what I'm doing wrong, brain just stopped working for some reason, cough, beer.

I have a jQuery slider, that sends GET data when form is submitted. This slider is a "price range" selector, and my problem is happening with the sent GET value.
Posted Image
<script>
	$(function() {
		$( "#slider-range" ).slider({
			range: true,
			min: 0,
			max: <?php echo $maxprice; ?>,
			values: [ 0, <?php echo $maxprice; ?> ],
			step: 10000,
			slide: function( event, ui ) {
				$( "#amount" ).val(ui.values[ 0 ] + " - " + ui.values[ 1 ] );
			}
		});
		$( "#amount" ).val( $( "#slider-range" ).slider( "values", 0 ) + " - " + $( "#slider-range" ).slider( "values", 1 ) );
	});
	</script>


The problem is that in the GET data, there's two + signs. For example, selecting 450000 - 2000000 will output:
450000+-+2000000

Can someone please tell me why these two plus signs are being added?
It really can't be something so extremely complicated, but I can't find it.

Is This A Good Question/Topic? 0
  • +

Replies To: jQuery Slider GET Value

#2 andrewsw  Icon User is offline

  • Fire giant boob nipple gun!
  • member icon

Reputation: 3227
  • View blog
  • Posts: 10,837
  • Joined: 12-December 12

Re: jQuery Slider GET Value

Posted 26 January 2013 - 02:19 PM

When the data is posted the spaces either side of the hyphen are translated to plus signs, because get (url) data cannot contain spaces.

Remove the two spaces either side of the hyphen in the last statement. If you still wish them to display on the page, then use a separate hidden input to store the version without spaces.
Was This Post Helpful? 1
  • +
  • -

#3 Joshdw  Icon User is offline

  • D.I.C Head

Reputation: 2
  • View blog
  • Posts: 225
  • Joined: 23-March 09

Re: jQuery Slider GET Value

Posted 26 January 2013 - 04:10 PM

Great! Thank you very much for the reply, knew it was something simple xD
Never knew that spaces were translated to plus signs, thanks for the info! Kudos
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1