<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0">
  <channel>
    <title>'Ajax + php passing parameter as array' Thread RSS Feed</title>
    <link>http://www.programmersheaven.com/</link>
    <description>Contains the latest posts from the thread 'Ajax + php passing parameter as array' posted on the 'AJAX' forum at Programmer's Heaven.</description>
    <language>en</language>
    <copyright>Copyright 2013 Programmers Heaven</copyright>
    <pubDate>Mon, 17 Jun 2013 21:48:00 -0700</pubDate>
    <lastBuildDate>Mon, 17 Jun 2013 21:48:00 -0700</lastBuildDate>
    <generator>Argotic Syndication Framework 2007.3.0.1, http://www.codeplex.com/Argotic</generator>
    <docs>http://www.rssboard.org/rss-specification</docs>
    <ttl>360</ttl>
    <image>
      <url>http://www.programmersheaven.com/images/ph.gif</url>
      <title>Programmers Heaven</title>
      <link>http://www.programmersheaven.com/</link>
      <width>88</width>
      <height>31</height>
    </image>
    <item>
      <title>Ajax + php passing parameter as array</title>
      <link>http://www.programmersheaven.com/mb/ajax/375944/375944/ajax-+-php-passing-parameter-as-array/</link>
      <description>I am building a web application in Ajax + Php.&lt;br /&gt;
Using Ajax, i would like to pass a javascript array containing some form values to a php script.&lt;br /&gt;
The script php then should get the array and access the array data.&lt;br /&gt;
But I cant get it working :p&lt;br /&gt;
I think I am doing something wrong in my js function...&lt;br /&gt;
&lt;br /&gt;
Here is my form:&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
&amp;lt;script&amp;gt;var p = new Array()&amp;lt;/script&amp;gt;
&amp;lt;form&amp;gt;
&amp;lt;b&amp;gt;Search Content:&amp;lt;/b&amp;gt; &amp;lt;input type="text" name="p[]" onkeyup="control(p,'content_get2')"&amp;gt;

&amp;lt;b&amp;gt;in&amp;lt;/b&amp;gt;
&amp;lt;select name="p[]"&amp;gt;
 &amp;lt;? $misc-&amp;gt;getSelectCategory(); ?&amp;gt; //fetch data in the db and build the select list
&amp;lt;/select&amp;gt;
&amp;lt;/form&amp;gt;
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
Here is my control function in my ajax.js&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
function control(p,action)
{ 
xmlHttp=GetXmlHttpObject()
if (xmlHttp==null)
 {
 alert ("Browser does not support HTTP Request")
 return
 }
var url= "include/"+ action +".php"
url=url+"?p[]="+p
url=url+"&amp;amp;sid="+Math.random()
xmlHttp.onreadystatechange=stateChanged 
xmlHttp.open("GET",url,true)
xmlHttp.send(null)
}
&lt;/pre&gt;&lt;br /&gt;
&lt;br /&gt;
And in my content_get2.php: $p = $_GET["p"];&lt;br /&gt;
Since I send my url+"?p[]="+p, i get an array, but its empty...&lt;br /&gt;
What do i do wrong?&lt;br /&gt;
&lt;br /&gt;
Please help me!&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ajax/375944/375944/ajax-+-php-passing-parameter-as-array/</guid>
      <pubDate>Wed, 24 Sep 2008 06:13:09 -0700</pubDate>
      <category>AJAX</category>
    </item>
    <item>
      <title>Re: Ajax + php passing parameter as array</title>
      <link>http://www.programmersheaven.com/mb/ajax/375944/402310/re-ajax-+-php-passing-parameter-as-array/#402310</link>
      <description>I recommend &lt;a href="http://script.aculo.us/downloads"&gt;http://script.aculo.us/downloads&lt;/a&gt; for ajax requests&lt;br /&gt;
&lt;br /&gt;
usage is much easier&lt;br /&gt;
&lt;br /&gt;
&lt;pre class="sourcecode"&gt;
function request()
{new Ajax.Request('usethesamepage.php', { method: 'get', parameters: { req: $('formname').serialize()}, onSuccess: function(p)  
{alert(p.responseText);}})}
&lt;/pre&gt;&lt;br /&gt;</description>
      <guid isPermaLink="true">http://www.programmersheaven.com/mb/ajax/375944/402310/re-ajax-+-php-passing-parameter-as-array/#402310</guid>
      <pubDate>Tue, 06 Oct 2009 12:08:34 -0700</pubDate>
      <category>AJAX</category>
    </item>
  </channel>
</rss>