<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>westworld: a webmasters best friend &#187; Prototype js multiple select</title>
	<atom:link href="http://www.westworld.be/tag/prototype-js-multiple-select/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.westworld.be</link>
	<description>A webmasters best friend</description>
	<lastBuildDate>Tue, 17 Aug 2010 10:37:26 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.0.1</generator>
		<item>
		<title>Prototype: submit multiple select with ajax call</title>
		<link>http://www.westworld.be/a-note-to-self/prototype-submit-multiple-select-with-ajax-call/</link>
		<comments>http://www.westworld.be/a-note-to-self/prototype-submit-multiple-select-with-ajax-call/#comments</comments>
		<pubDate>Tue, 11 Aug 2009 12:45:37 +0000</pubDate>
		<dc:creator>westworld</dc:creator>
				<category><![CDATA[a note to self]]></category>
		<category><![CDATA[Prototype js multiple select]]></category>

		<guid isPermaLink="false">http://www.westworld.be/?p=107</guid>
		<description><![CDATA[Beware when posting data from a multiple select through ajax. You can&#8217;t send an array with a Prototype ajax call. expl. function postmydata(){ new Ajax.Request(&#8216;data.php&#8217;, { method:&#8217;post&#8217;, parameters: {selectdata: $F(&#8216;myselect&#8217;)}, onSuccess: function(transport){ var response = transport.responseText &#124;&#124; alert(&#8220;couldn&#8217;t add data&#8221;); $(&#8216;mydiv&#8217;).update(response); }, onFailure: function(){ $(&#8216;mydiv&#8217;).update(&#8216;error&#8217;); } }); } This won&#8217;t work. Your php page will [...]


Related posts:<ol><li><a href='http://www.westworld.be/uncategorized/pdo-get-column-names/' rel='bookmark' title='Permanent Link: Pdo get column names'>Pdo get column names</a></li></ol>]]></description>
			<content:encoded><![CDATA[<p>Beware when posting data from a multiple select through ajax. You can&#8217;t send an array with a Prototype ajax call.</p>
<p>expl.</p>
<p>function postmydata(){<br />
new Ajax.Request(&#8216;data.php&#8217;,<br />
{<br />
method:&#8217;post&#8217;,<br />
parameters: {selectdata: $F(&#8216;myselect&#8217;)},<br />
onSuccess: function(transport){<br />
var response = transport.responseText || alert(&#8220;couldn&#8217;t add data&#8221;);<br />
$(&#8216;mydiv&#8217;).update(response);<br />
},<br />
onFailure: function(){ $(&#8216;mydiv&#8217;).update(&#8216;error&#8217;); }<br />
});<br />
}</p>
<p>This won&#8217;t work. Your php page will not get an array.</p>
<p>Solution</p>
<p>replace the parameter part with:<br />
parameters: {selectdata: $F(&#8216;myselect&#8217;).join(&#8220;,&#8221;)}, // this will send a comma seperated string<br />
In your php code use:<br />
$myselect = = explode(&#8216;,&#8217;,$_POST['selectdata']);<br />
<h4>Related Blogs</h4>
<ul class="pc_pingback">
<li class="hdl" style="list-style: none">Related Blogs on <b></b></li>
<li><a href="http://www.spottedhere.com/dallas/club/joyce+nightclub">Joyce Dallas</a>
</li>
</ul>


<p>Related posts:<ol><li><a href='http://www.westworld.be/uncategorized/pdo-get-column-names/' rel='bookmark' title='Permanent Link: Pdo get column names'>Pdo get column names</a></li></ol></p>]]></content:encoded>
			<wfw:commentRss>http://www.westworld.be/a-note-to-self/prototype-submit-multiple-select-with-ajax-call/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
