473,378 Members | 1,344 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

javascript/ajax to mysql db

anfetienne
424 256MB
could anyone tell me the mthod to use javascript/ajax to post to a sql database? or could someone point me to a tutorial?
Apr 27 '09 #1
61 3702
dmjpro
2,476 2GB
You can have a look at this.
Apr 28 '09 #2
Markus
6,050 Expert 4TB
You'll need some server-side processing to communicate with a db.
Apr 28 '09 #3
anfetienne
424 256MB
ive got the code to communicate with a database....thanks ill take a look
Apr 28 '09 #4
anfetienne
424 256MB
i've read over this site a few times....it doesn't have any details of what i need.

i basically need the details of a form to be duplicated on mouseover of the submit button once all fields have been filled in (i already wrote a code to check if form fields have been completed)....it takes the values from each field and sends it to a php page so that i can add it to a var and then enter it into a database.

the method you showed me is the right one but i don't have a clue where to start when it comes to forms as this has nothing on forms
Apr 29 '09 #5
acoder
16,027 Expert Mod 8TB
What kind of form elements do you have? Text boxes, hidden fields, password and textarea are easy:
Expand|Select|Wrap|Line Numbers
  1. "fieldname=" + encodeURIComponent(document.getElementById("fieldID").value);
To get the values for other elements, e.g. select (single), get the value, and select (multiple), check the selected options. For check boxes and radio buttons, you need to find the checked buttons.
Apr 30 '09 #6
anfetienne
424 256MB
im using hidden fields to duplicate the value from visible fields into onChange....im looking for a way the values can go into php without having to refresh or go to a new page. if this cant be done can 1 form submit to two different pages?
Apr 30 '09 #7
acoder
16,027 Expert Mod 8TB
There's no need to duplicate values. You can use the values from the visible fields. Show your Ajax code and I can suggest changes.
Apr 30 '09 #8
anfetienne
424 256MB
i dont have any....the only ajax examples i could find were to xml.....none to php so i don't even know where to start.
Apr 30 '09 #9
acoder
16,027 Expert Mod 8TB
All you have to do is replace the XML file with a PHP one, e.g. the URL would be test.php instead of test.xml.
Apr 30 '09 #10
anfetienne
424 256MB
so if i took this code here which is an xml example....all i would have to do is change the file name at the end?

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" language="javascript">
  2.     function makeRequest(url) {
  3.         var httpRequest;
  4.  
  5.         if (window.XMLHttpRequest) { // Mozilla, Safari, ...
  6.             httpRequest = new XMLHttpRequest();
  7.             if (httpRequest.overrideMimeType) {
  8.                 httpRequest.overrideMimeType('text/xml');
  9.                 // See note below about this line
  10.             }
  11.         } 
  12.         else if (window.ActiveXObject) { // IE
  13.             try {
  14.                 httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
  15.             } 
  16.             catch (e) {
  17.                 try {
  18.                     httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  19.                 } 
  20.                 catch (e) {}
  21.             }
  22.         }
  23.  
  24.         if (!httpRequest) {
  25.             alert('Giving up :( Cannot create an XMLHTTP instance');
  26.             return false;
  27.         }
  28.         httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
  29.         httpRequest.open('GET', url, true);
  30.         httpRequest.send('');
  31.  
  32.     }
  33.  
  34.     function alertContents(httpRequest) {
  35.  
  36.         if (httpRequest.readyState == 4) {
  37.             if (httpRequest.status == 200) {
  38.                 alert(httpRequest.responseText);
  39.             } else {
  40.                 alert('There was a problem with the request.');
  41.             }
  42.         }
  43.  
  44.     }
  45. </script>
  46. <span
  47.     style="cursor: pointer; text-decoration: underline"
  48.     onclick="makeRequest('test.xml')">
  49.         Make a request
  50. </span>
  51.  
Apr 30 '09 #11
Dormilich
8,658 Expert Mod 8TB
@anfetienne
that's correct.

[end limit]
Apr 30 '09 #12
Ciary
247 Expert 100+
and maybe the mimetype, but i dont think you need it.

to make a request object you need this:
Expand|Select|Wrap|Line Numbers
  1. var httpRequest;
  2.  
  3. try{
  4.     httpRequest = new ActiveXObject("MSXML2.XMLHTTP");
  5. }catch(exception1){
  6.     try{
  7.         httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  8.     }catch(exception2){
  9.         httpRequest = false;
  10.     }
  11.  
  12.     if(!httpRequest && window.XMLHttpRequest){
  13.         httpRequest = new XMLHttpRequest();
  14.     }
  15. }
  16.  
then your php will contain an update-query.

Expand|Select|Wrap|Line Numbers
  1. $id = mssql_connect('***.***.***.***,1433','mssqluser','passwd');
  2. mssql_select_db("myDB",$id);
  3.  
  4. result = mssql_query("UPDATE table_name SET column_name = ".$_GET['value']." WHERE id = ".$_GET['id']);
  5.  
  6. mssql_close($id);
  7.  
Apr 30 '09 #13
acoder
16,027 Expert Mod 8TB
That's what you would have to do to make a request to a PHP file, but in that PHP file, it should contain the code to deal with the passed values. The change you have to make to pass form values would be in makeRequest before you open:
Expand|Select|Wrap|Line Numbers
  1. url += "&fieldname=" + encodeURIComponent(document.getElementById("fieldID").value);
assuming you already have a parameter, e.g. "file.php?var=1".
Apr 30 '09 #14
anfetienne
424 256MB
by the looks of what you're saying ciary i have to replace this with your first piece of coding.

Expand|Select|Wrap|Line Numbers
  1.          if (window.XMLHttpRequest) { // Mozilla, Safari, ...
  2.              httpRequest = new XMLHttpRequest();
  3.              if (httpRequest.overrideMimeType) {
  4.                  httpRequest.overrideMimeType('text/xml');
  5.                  // See note below about this line
  6.              }
  7.          } 
  8.          else if (window.ActiveXObject) { // IE
  9.              try {
  10.                  httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
  11.              } 
  12.              catch (e) {
  13.                  try {
  14.                      httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  15.                  } 
  16.                  catch (e) {}
  17.              }
  18.          }
is that correct?
Apr 30 '09 #15
acoder
16,027 Expert Mod 8TB
There's no need for that. The code you already have is actually better.
Apr 30 '09 #16
anfetienne
424 256MB
ok just looking over a tutorial and this code do i need to do changes to the function alertContents(httpRequest) or is that fine as well?
Apr 30 '09 #17
acoder
16,027 Expert Mod 8TB
Well, you would need to make changes to that unless you only wish to alert the response.

What exactly are you attempting to do by submitting the form? Do you want to give some notification when it's complete?
Apr 30 '09 #18
Ciary
247 Expert 100+
no, it's fine. but if you only have an update query, you won't have a responsetext so it will be unnecessary.
[EDIT] unless you have a echo something in php like acoder said.

if you still want to alert something or hide a loader when the update is done, you can use that instead.
Apr 30 '09 #19
anfetienne
424 256MB
what it is.....its a paypal form but i want to save the form details into a database before it goes to paypal then once the paypal purchase is complete the user would be redirected to a page to confirm their email address so a confimation email is sent to them with a username and password....i've had to go about it this way because paypal do not allow fo extra confirmation emails and refuse to add that option on any account, at 1st i tried to use curl but paypal doesn't allow that....so the only way was with javascript/ajax so it does it all on the same page then the user can just click submit and it will go straight to paypal
Apr 30 '09 #20
acoder
16,027 Expert Mod 8TB
What information do you want to save in the database? Post the form HTML code.
Apr 30 '09 #21
anfetienne
424 256MB
Expand|Select|Wrap|Line Numbers
  1.                       <table width="675" border="0" align="center" cellpadding="0" cellspacing="0">
  2.                           <tr>
  3.                             <td><form action="" method="post" target="paypal" id="form">
  4.                                 <p>
  5.                                   <input type="hidden" name="on0" value="shipping To:" />
  6.                               </p>
  7.                               <table width="675" border="0" align="center" cellpadding="0" cellspacing="0">
  8.                                   <tr>
  9.                                     <td height="825" background="images/leadBox.jpg"><table width="550" height="133" border="0" align="center" cellpadding="0" cellspacing="0">
  10.                                         <tr>
  11.                                           <td height="40"><div align="center"><span class="style112">All fields marked with <span class="style114">*</span> are required and must be entered before continuing to the secured paypal payment page.</span></div></td>
  12.                                         </tr>
  13.                                         <tr>
  14.                                           <td height="25">&nbsp;</td>
  15.                                         </tr>
  16.                                         <tr>
  17.                                           <td><table width="490" border="0" cellspacing="0" cellpadding="0">
  18.                                               <tr>
  19.                                                 <td height="28" bgcolor="#666666"><span class="style118">...</span><span class="style116">Product Order</span></td>
  20.                                               </tr>
  21.                                               <tr>
  22.                                                 <td><table width="550" border="1" cellspacing="0" cellpadding="0">
  23.                                                     <tr>
  24.                                                       <td width="71" height="25" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Quantity</span></div></td>
  25.                                                       <td width="407" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Description</span></div></td>
  26.                                                       <td width="64" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Price</span></div></td>
  27.                                                   </tr>
  28.                                                     <tr>
  29.                                                       <td><div align="center" class="style121">1</div></td>
  30.                                                       <td height="50"><table width="400" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
  31.                                                           <tr>
  32.                                                             <td><div align="left"><span class="style149">Adam Ginsberg’s ‘The Closely Guarded Secrets Of An eBay  Millionaire – Make Money On eBay’</span></div></td>
  33.                                                           </tr>
  34.                                                       </table></td>
  35.                                                       <td height="30"><div align="center" class="style121">
  36.                                                         <p>£97.00<br />
  37.                                                         (inc VAT)</p>
  38.                                                         </div></td>
  39.                                                     </tr>
  40.                                                     <tr>
  41.                                                       <td height="32">&nbsp;</td>
  42.                                                       <td><table width="400" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
  43.                                                           <tr>
  44.                                                             <td><div align="left">
  45.                                                                 <p class="style121">Postage &amp; Packaging:<br />
  46.                                                                   <strong>Calculated via Royal Mail according to Country 
  47.                                                               of Residence</strong></p>
  48.                                                             </div></td>
  49.                                                           </tr>
  50.                                                       </table></td>
  51.                                                       <td height="32">&nbsp;</td>
  52.                                                     </tr>
  53.                                                     <tr>
  54.                                                       <td height="23" bgcolor="#CCCCCC">&nbsp;</td>
  55.                                                       <td bgcolor="#CCCCCC"><div align="right" class="style123">Sub-Total<span class="style124">..</span></div></td>
  56.                                                       <td bgcolor="#CCCCCC"><div align="center" class="style123">£97.00</div></td>
  57.                                                     </tr>
  58.                                                 </table></td>
  59.                                               </tr>
  60.                                           </table></td>
  61.                                         </tr>
  62.                                         <tr>
  63.                                           <td height="28" bgcolor="#FFFFFF">&nbsp;</td>
  64.                                         </tr>
  65.                                         <tr>
  66.                                           <td height="28" bgcolor="#666666"><span class="style118">...</span><span class="style116">Billing Information</span></td>
  67.                                         </tr>
  68.                                       </table>
  69.                                         <table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  70.                                           <tr>
  71.                                             <td bgcolor="#CCCCCC"><table width="475" border="0" align="center" cellpadding="2" cellspacing="2">
  72.                                                 <tr>
  73.                                                   <td>&nbsp;</td>
  74.                                                   <td>&nbsp;</td>
  75.                                                   <td>&nbsp;</td>
  76.                                                 </tr>
  77.                                                 <tr>
  78.                                                   <td><div align="left"><span class="style123">First Name: </span></div></td>
  79.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  80.                                                   <td><div align="left">
  81.                                                       <input type="text" name="first_name" value="" />
  82.                                                   </div></td>
  83.                                                 </tr>
  84.                                                 <tr>
  85.                                                   <td><div align="left"><span class="style123">Last Name: </span></div></td>
  86.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  87.                                                   <td><div align="left">
  88.                                                       <input type="text" name="last_name" value="" />
  89.                                                   </div></td>
  90.                                                 </tr>
  91.                                                 <tr>
  92.                                                   <td class="style123"><div align="left"><span class="style96">Address Line 1: </span></div></td>
  93.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  94.                                                   <td><div align="left">
  95.                                                       <input type="text" name="address1" value="" />
  96.                                                   </div></td>
  97.                                                 </tr>
  98.                                                 <tr>
  99.                                                   <td class="style123"><div align="left"><span class="style96">Address Line 2: </span></div></td>
  100.                                                   <td>&nbsp;</td>
  101.                                                   <td><div align="left">
  102.                                                       <input type="text" name="address2" value="" />
  103.                                                   </div></td>
  104.                                                 </tr>
  105.                                                 <tr>
  106.                                                   <td class="style123"><div align="left"><span class="style96">City: </span></div></td>
  107.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  108.                                                   <td><div align="left">
  109.                                                       <input type="text" name="city" value="" />
  110.                                                   </div></td>
  111.                                                 </tr>
  112.                                                 <tr>
  113.                                                   <td class="style123"><div align="left"><span class="style96">County/State/Province: </span></div></td>
  114.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  115.                                                   <td><div align="left">
  116.                                                       <input type="text" name="state" value="" />
  117.                                                   </div></td>
  118.                                                 </tr>
  119.                                                 <tr>
  120.                                                   <td class="style123"><div align="left"><span class="style96">Postal Code/Zip Code: </span></div></td>
  121.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  122.                                                   <td><div align="left">
  123.                                                       <input type="text" name="zip" value="" />
  124.                                                   </div></td>
  125.                                                 </tr>
  126.                                                 <tr>
  127.                                                   <td class="style123"><div align="left"><span class="style96">Country: </span></div></td>
  128.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  129.                                                   <td><div align="left">
  130.                                                       <select name="os0" id="os0">
  131.                                                         <option value="">Please Select ...</option>
  132.                                                         <option value="Albania">Albania</option>
  133.                                                         <option value="Algeria">Algeria</option>
  134.                                                         <option value="Andorra">Andorra</option>
  135.                                                         <option value="Angola">Angola</option>
  136.                                                         <option value="Anguilla">Anguilla</option>
  137.                                                         <option value="Antigua &amp; Barbuda">Antigua &amp; Barbuda</option>
  138.                                                         <option value="Argentina">Argentina</option>
  139.                                                         <option value="Armenia">Armenia</option>
  140.                                                         <option value="Aruba">Aruba</option>
  141.                                                         <option value="Australia">Australia</option>
  142.                                                         <option value="Austria">Austria</option>
  143.                                                         <option value="Azerbaijan">Azerbaijan</option>
  144.                                                         <option value="Bahamas">Bahamas</option>
  145.                                                         <option value="Bahrain">Bahrain</option>
  146.                                                         <option value="Barbados">Barbados</option>
  147.                                                         <option value="Belgium">Belgium</option>
  148.                                                         <option value="Belize">Belize</option>
  149.                                                         <option value="Benin">Benin</option>
  150.                                                         <option value="Bermuda">Bermuda</option>
  151.                                                         <option value="Bhutan">Bhutan</option>
  152.                                                         <option value="Bolivia">Bolivia</option>
  153.                                                         <option value="Bosnia-Herzegovina">Bosnia-Herzegovina</option>
  154.                                                         <option value="Botswana">Botswana</option>
  155.                                                         <option value="Brazil">Brazil</option>
  156.                                                         <option value="British Virgin Islands">British Virgin Islands</option>
  157.                                                         <option value="Brunei Darussalam">Brunei Darussalam</option>
  158.                                                         <option value="Bulgaria (Republic)">Bulgaria (Republic)</option>
  159.                                                         <option value="Burkina Faso">Burkina Faso</option>
  160.                                                         <option value="Burundi">Burundi</option>
  161.                                                         <option value="Cambodia">Cambodia</option>
  162.                                                         <option value="Canada">Canada</option>
  163.                                                         <option value="Cape Verde">Cape Verde</option>
  164.                                                         <option value="Cayman Islands">Cayman Islands</option>
  165.                                                         <option value="Chad">Chad</option>
  166.                                                         <option value="Chile">Chile</option>
  167.                                                         <option value="China (People's Republic)">China (People's Republic)</option>
  168.                                                         <option value="Cocos (Keeling Islands)">Cocos (Keeling Islands)</option>
  169.                                                         <option value="Colombia">Colombia</option>
  170.                                                         <option value="Comoros">Comoros</option>
  171.                                                         <option value="Congo (Democratic Republic)">Congo (Democratic Republic)</option>
  172.                                                         <option value="Congo (People's Republic of)">Congo (People's Republic of)</option>
  173.                                                         <option value="Cook Islands">Cook Islands</option>
  174.                                                         <option value="Costa Rica">Costa Rica</option>
  175.                                                         <option value="Croatia">Croatia</option>
  176.                                                         <option value="Cyprus">Cyprus</option>
  177.                                                         <option value="Czech Republic">Czech Republic</option>
  178.                                                         <option value="Denmark">Denmark</option>
  179.                                                         <option value="Djibouti">Djibouti</option>
  180.                                                         <option value="Dominica">Dominica</option>
  181.                                                         <option value="Dominican Republic">Dominican Republic</option>
  182.                                                         <option value="Ecuador">Ecuador</option>
  183.                                                         <option value="El Salvador">El Salvador</option>
  184.                                                         <option value="Equatorial Guinea">Equatorial Guinea</option>
  185.                                                         <option value="Eritrea">Eritrea</option>
  186.                                                         <option value="Estonia">Estonia</option>
  187.                                                         <option value="Ethiopia">Ethiopia</option>
  188.                                                         <option value="Falkland Islands">Falkland Islands</option>
  189.                                                         <option value="Faroe Islands">Faroe Islands</option>
  190.                                                         <option value="Fiji">Fiji</option>
  191.                                                         <option value="Finland">Finland</option>
  192.                                                         <option value="France">France</option>
  193.                                                         <option value="French Guiana">French Guiana</option>
  194.                                                         <option value="French Polynesia">French Polynesia</option>
  195.                                                         <option value="Gabon">Gabon Republic</option>
  196.                                                         <option value="Gambia">Gambia</option>
  197.                                                         <option value="Germany">Germany</option>
  198.                                                         <option value="Ghana">Ghana</option>
  199.                                                         <option value="Gibraltar">Gibraltar</option>
  200.                                                         <option value="Greece">Greece</option>
  201.                                                         <option value="Greenland">Greenland</option>
  202.                                                         <option value="Grenada">Grenada</option>
  203.                                                         <option value="Guadeloupe">Guadeloupe</option>
  204.                                                         <option value="Guatemala">Guatemala</option>
  205.                                                         <option value="Guinea">Guinea</option>
  206.                                                         <option value="Guinea-Bissau">Guinea-Bissau</option>
  207.                                                         <option value="Guyana">Guyana</option>
  208.                                                         <option value="Honduras">Honduras</option>
  209.                                                         <option value="Hong Kong">Hong Kong</option>
  210.                                                         <option value="Hungary">Hungary</option>
  211.                                                         <option value="Iceland">Iceland</option>
  212.                                                         <option value="India">India</option>
  213.                                                         <option value="Indonesia">Indonesia</option>
  214.                                                         <option value="Ireland (Republic)">Ireland (Republic)</option>
  215.                                                         <option value="Israel">Israel</option>
  216.                                                         <option value="Italy">Italy</option>
  217.                                                         <option value="Jamaica">Jamaica</option>
  218.                                                         <option value="Japan">Japan</option>
  219.                                                         <option value="Jordan">Jordan</option>
  220.                                                         <option value="Kazakhstan">Kazakhstan</option>
  221.                                                         <option value="Kenya">Kenya</option>
  222.                                                         <option value="Kiribati">Kiribati</option>
  223.                                                         <option value="Kuwait">Kuwait</option>
  224.                                                         <option value="Kyrgyzstan">Kyrgyzstan</option>
  225.                                                         <option value="Laos">Laos</option>
  226.                                                         <option value="Latvia">Latvia</option>
  227.                                                         <option value="Lesotho">Lesotho</option>
  228.                                                         <option value="Liechtenstein">Liechtenstein</option>
  229.                                                         <option value="Lithuania">Lithuania</option>
  230.                                                         <option value="Luxembourg">Luxembourg</option>
  231.                                                         <option value="Madagascar">Madagascar</option>
  232.                                                         <option value="Malawi">Malawi</option>
  233.                                                         <option value="Malaysia">Malaysia</option>
  234.                                                         <option value="Maldives">Maldives</option>
  235.                                                         <option value="Mali">Mali</option>
  236.                                                         <option value="Malta">Malta</option>
  237.                                                         <option value="Marshall Islands">Marshall Islands</option>
  238.                                                         <option value="Martinique">Martinique</option>
  239.                                                         <option value="Mauritania">Mauritania</option>
  240.                                                         <option value="Mauritius">Mauritius</option>
  241.                                                         <option value="Mayotte">Mayotte</option>
  242.                                                         <option value="Mexico">Mexico</option>
  243.                                                         <option value="Micronesia (Fed. States of)">Micronesia (Fed. States of)</option>
  244.                                                         <option value="Monaco">Monaco</option>
  245.                                                         <option value="Mongolia">Mongolia</option>
  246.                                                         <option value="Montserrat">Montserrat</option>
  247.                                                         <option value="Morocco">Morocco</option>
  248.                                                         <option value="Mozambique">Mozambique</option>
  249.                                                         <option value="Namibia">Namibia</option>
  250.                                                         <option value="Nauru">Nauru</option>
  251.                                                         <option value="Nepal">Nepal</option>
  252.                                                         <option value="Netherlands">Netherlands</option>
  253.                                                         <option value="Netherlands Antilles">Netherlands Antilles</option>
  254.                                                         <option value="New Caledonia">New Caledonia</option>
  255.                                                         <option value="New Zealand">New Zealand</option>
  256.                                                         <option value="Nicaragua">Nicaragua</option>
  257.                                                         <option value="Niger">Niger</option>
  258.                                                         <option value="Niue">Niue</option>
  259.                                                         <option value="Norfolk Island">Norfolk Island</option>
  260.                                                         <option value="Norway">Norway</option>
  261.                                                         <option value="Oman">Oman</option>
  262.                                                         <option value="Palau (Belau)">Belau (Pelau)</option>
  263.                                                         <option value="Panama">Panama</option>
  264.                                                         <option value="Papua New Guinea">Papua New Guinea</option>
  265.                                                         <option value="Peru">Peru</option>
  266.                                                         <option value="Philippines">Philippines</option>
  267.                                                         <option value="Pitcairn Islands">Pitcairn Islands</option>
  268.                                                         <option value="Poland">Poland</option>
  269.                                                         <option value="Portugal">Portugal</option>
  270.                                                         <option value="Qatar">Qatar</option>
  271.                                                         <option value="Reunion">Reunion</option>
  272.                                                         <option value="Romania">Romania</option>
  273.                                                         <option value="Russia">Russia</option>
  274.                                                         <option value="Rwanda">Rwanda</option>
  275.                                                         <option value="Samoa">Samoa</option>
  276.                                                         <option value="San Marino">San Marino</option>
  277.                                                         <option value="Sao Tome &amp; Principe">Sao Tome &amp; Principe</option>
  278.                                                         <option value="Saudi Arabia">Saudi Arabia</option>
  279.                                                         <option value="Senegal">Senegal</option>
  280.                                                         <option value="Seychelles">Seychelles</option>
  281.                                                         <option value="Sierra Leone">Sierra Leone</option>
  282.                                                         <option value="Singapore">Singapore</option>
  283.                                                         <option value="Slovakia">Slovakia</option>
  284.                                                         <option value="Slovenia">Slovenia</option>
  285.                                                         <option value="Solomon Islands">Solomon Islands</option>
  286.                                                         <option value="Somalia">Somalia</option>
  287.                                                         <option value="South Africa">South Africa</option>
  288.                                                         <option value="South Korea">South Korea</option>
  289.                                                         <option value="Spain">Spain</option>
  290.                                                         <option value="Sri Lanka">Sri Lanka</option>
  291.                                                         <option value="St Christopher(St Kitts) &amp; Nevis">St Christopher(St Kitts) &amp; Nevis</option>
  292.                                                         <option  value="St Helena">St Helena</option>
  293.                                                         <option  value="St Lucia">St Lucia</option>
  294.                                                         <option value="St Pierre &amp; Miquelon">St Pierre &amp; Miquelon</option>
  295.                                                         <option value="St Vincent &amp; Grenadines">St Vincent &amp; Grenadines</option>
  296.                                                         <option  value="Suriname">Suriname</option>
  297.                                                         <option  value="Svalbard and Jan Mayen Islands">Svalbard and Jan Mayen Islands</option>
  298.                                                         <option  value="Suriname">Suriname</option>
  299.                                                         <option  value="Swaziland">Swaziland</option>
  300.                                                         <option  value="Sweden">Sweden</option>
  301.                                                         <option  value="Switzerland">Switzerland</option>
  302.                                                         <option  value="Syria">Syria</option>
  303.                                                         <option  value="Taiwan">Taiwan</option>
  304.                                                         <option  value="Tajikistan">Tajikistan</option>
  305.                                                         <option  value="Tanzania">Tanzania</option>
  306.                                                         <option  value="Thailand">Thailand</option>
  307.                                                         <option  value="Togo">Togo</option>
  308.                                                         <option  value="Tonga">Tonga</option>
  309.                                                         <option value="Trinidad &amp; Tobago">Trinidad &amp; Tobago</option>
  310.                                                         <option  value="Tunisia">Tunisia</option>
  311.                                                         <option  value="Turkey">Turkey</option>
  312.                                                         <option  value="Turkmenistan">Turkmenistan</option>
  313.                                                         <option value="Turks &amp; Caicos Islands">Turks &amp; Caicos Islands</option>
  314.                                                         <option  value="Tuvalu">Tuvalu</option>
  315.                                                         <option  value="Uganda">Uganda</option>
  316.                                                         <option  value="Ukraine">Ukraine</option>
  317.                                                         <option  value="United Arab Emirates">United Arab Emirates</option>
  318.                                                         <option  value="United Kingdom">United Kingdom</option>
  319.                                                         <option  value="United States Of America">United States Of America</option>
  320.                                                         <option  value="Uruguay">Uruguay</option>
  321.                                                         <option  value="Vanuatu">Vanuatu</option>
  322.                                                         <option  value="Vatican City State">Vatican City State</option>
  323.                                                         <option  value="Venezuela">Venezuela</option>
  324.                                                         <option  value="Vietnam">Vietnam</option>
  325.                                                         <option value="Wallis &amp; Futuna Islands">Wallis &amp; Futuna Islands</option>
  326.                                                         <option  value="Yemen">Yemen</option>
  327.                                                         <option  value="Zambia">Zambia</option>
  328.                                                       </select>
  329.                                                   </div></td>
  330.                                                 </tr>
  331.  
  332.                                                 <tr>
  333.                                                   <td class="style123"><div align="left">Email Address</div></td>
  334.                                                   <td><span class="style150">*</span></td>
  335.                                                   <td><div align="left">
  336.                                                     <input type="text" name="email" value="" id="email" />
  337.                                                   </div></td>
  338.                                                 </tr>
  339.                                             </table></td>
  340.                                           </tr>
  341.                                           <tr>
  342.                                             <td height="50" bgcolor="#CCCCCC"><div align="center">
  343.                                                 <input name="submit" type="image" onclick="CalculateOrder(this.form)" onmouseover="validate(this.form)" src="https://www.theauctionwinners.com/main/payment/images/paymentBtn.gif" alt="Continue To PayPal" width="152" height="50" border="0" />
  344.                                                 <input type="hidden" name="upload" value="1" />
  345.                                                 <input type="hidden" name="cmd" value="_cart" />
  346.                                                 <input type="hidden" name="business" value="john@future-resourcings.com" />
  347.                                                 <input type="hidden" name="item_name_1" value="Adam Ginsberg's The Closely Guarded Secrets Of An Ebay Millionaire - Make Money On eBay - FAST TRACK DVD Home Study Course (Inc VAT)" />
  348.                                                 <input type="hidden" name="quantity_1" value="1" />
  349.                                                 <input type="hidden" name="amount_1" value="97.00" />
  350.                                                 <input type="hidden" name="shipping_1" />
  351.                                                 <input type="hidden" name="item_number_1" />
  352.                                                 <input type="hidden" name="country" />
  353.                                                 <input type="hidden" name="currency_code" value="GBP"/>
  354.                                                 <input type="hidden" name="no_shipping" value="2" />
  355.                                                 <input type="hidden" name="return" value="http://www.theauctionwinners.com/main" />
  356.                                                 <input type="hidden" name="bn" value="TheAuctionWinners_ShopCart_WPS_GB" />
  357.                                                 <!-- Enable override of payer’s stored PayPal address. -->
  358.                                                 <input type="hidden" name="address_override" value="1" />
  359.                                             </div></td>
  360.                                           </tr>
  361.                                           <tr>
  362.                                             <td bgcolor="#FFFFFF"><div align="center"><span class="style125">I authorise Future Resourcings Ltd to charge me for the above sub-total and forthcoming postage &amp; package.
  363.                                               I further affirm that the personal information provided on this form are true and correct.</span></div></td>
  364.                                           </tr>
  365.                                         </table>
  366.  
Apr 30 '09 #22
acoder
16,027 Expert Mod 8TB
and which of these fields do you want to store in the database?
Apr 30 '09 #23
anfetienne
424 256MB
all fields except the hidden fields need to be stored as its to build a customer database
Apr 30 '09 #24
acoder
16,027 Expert Mod 8TB
For the fields, either add an ID so you can use document.getElementById() to access them or use:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("form").elements[name-of-field].value
To make a POST request (use the send() method), construct the field-value parameters, e.g.
Expand|Select|Wrap|Line Numbers
  1. var urlparams = "first_name=" + encodeURIComponent(document.getElementById("first_name").value);
  2. urlparams += "&last_name=" + encodeURIComponent(document.getElementById("first_name").value);
  3. // and so on...
Apr 30 '09 #25
anfetienne
424 256MB
@acoder

you have lost me on here....im a newbie with ajax, i dont want any alerts as long as i test it and see the values going into the database that's fine.

"file.php?var=1" <---where do i add this in?
Apr 30 '09 #26
acoder
16,027 Expert Mod 8TB
That was with a GET request. Are you using GET or POST in PHP?
Apr 30 '09 #27
anfetienne
424 256MB
ok i understand on how to select the fields i need but i don't understand where to put that in the code
Apr 30 '09 #28
anfetienne
424 256MB
paypal uses post...can't use get unfortunately
Apr 30 '09 #29
acoder
16,027 Expert Mod 8TB
It doesn't matter if Paypal uses Post. I'm asking about your PHP code.

Let's assume POST. Then keep the URL free of parameters and send the parameters via the send method:
Expand|Select|Wrap|Line Numbers
  1. httpRequest.send(urlparams);
Apr 30 '09 #30
acoder
16,027 Expert Mod 8TB
@anfetienne
Before you open the request (before line 28 in post #11), then change 'GET' to 'POST':
Expand|Select|Wrap|Line Numbers
  1. httpRequest.open('POST',url,true);
Apr 30 '09 #31
anfetienne
424 256MB
@acoder
now i understand what you done here....i think i get all of it almost......last thing is where do i place this in my ajax code?
Apr 30 '09 #32
anfetienne
424 256MB
Thanks in advance everyone....been a great help!!!!
Apr 30 '09 #33
Ciary
247 Expert 100+
if you did this with GET you would have done this

Expand|Select|Wrap|Line Numbers
  1. var url = "file.php"
  2. url += "?firstname="+document.getElementById("form").elements['first_name'].value
  3. url += "&lastname="+document.getElementById("form").elements['last_name'].value
  4. url += "&city="+document.getElementById("form").elements['city'].value
  5.  
  6. //... you have to do all your fields like this
  7. httpRequest.open('GET',url,true);
  8.  
Apr 30 '09 #34
acoder
16,027 Expert Mod 8TB
@anfetienne
Before the onreadystatechange line.
Apr 30 '09 #35
anfetienne
424 256MB
ok final question lol...thanks again for the help though......say i put all this coding in a file index.php and i wanted it to do everything within this file would i call the file at the end index.php? and would it be best to use the if and else statement in php to run the sql once ajax has done its part?
Apr 30 '09 #36
acoder
16,027 Expert Mod 8TB
It might be easier to keep it in separate files, but if you do want it in one file, then yes, you would need to use if-else to ensure that the correct part is run, e.g. by checking the existence of one of the POST-ed values.
Apr 30 '09 #37
anfetienne
424 256MB
ok got it....thanks for all the help im going to be testing tomorrow so ill let you know the results then
May 1 '09 #38
anfetienne
424 256MB
i forgot to ask....what is it i put to run onmouseover or onsubmit etc?
May 6 '09 #39
acoder
16,027 Expert Mod 8TB
Do you mean your validation function? It should run onsubmit, but if you're using Ajax to submit the form, you could just call the validation function within the makeRequest() function.
May 6 '09 #40
anfetienne
424 256MB
ok ive tested the code and it works the only problem i'm having is that it won't run the code without opening another page. So far i have only got it to work when the form submission looks like this

<form action="" method="post" target="paypal" id="form">

this opens a new window and it does as it should then but i can't get it to run in the same window
May 6 '09 #41
anfetienne
424 256MB
i think this is where if and if else would come in actually....i know this should be in the php forum but as you mentioned it how do you do a if statement on $_POST
May 6 '09 #42
acoder
16,027 Expert Mod 8TB
You can use isset to check if a variable is set.
May 6 '09 #43
acoder
16,027 Expert Mod 8TB
@anfetienne
Can you post the latest version of your code.
May 6 '09 #44
anfetienne
424 256MB
this is my code

Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript" language="javascript">
  2.     function makeRequest(url) {
  3.         var httpRequest;
  4.  
  5.         if (window.XMLHttpRequest) { // Mozilla, Safari, ...
  6.             httpRequest = new XMLHttpRequest();
  7.             if (httpRequest.overrideMimeType) {
  8.                 httpRequest.overrideMimeType('text/xml');
  9.                 // See note below about this line
  10.             }
  11.         } 
  12.         else if (window.ActiveXObject) { // IE
  13.             try {
  14.                 httpRequest = new ActiveXObject("Msxml2.XMLHTTP");
  15.             } 
  16.             catch (e) {
  17.                 try {
  18.                     httpRequest = new ActiveXObject("Microsoft.XMLHTTP");
  19.                 } 
  20.                 catch (e) {}
  21.             }
  22.         }
  23.  
  24.         if (!httpRequest) {
  25.             alert('Giving up :( Cannot create an XMLHTTP instance');
  26.             return false;
  27.         }
  28.  
  29.         //enter var details for fields here
  30.         var urlparams = "first_name=" + encodeURIComponent(document.getElementById("first_name").value);
  31.         urlparams += "&last_name=" + encodeURIComponent(document.getElementById("last_name").value);
  32.         urlparams += "&address1=" + encodeURIComponent(document.getElementById("address1").value);
  33.         urlparams += "&address2=" + encodeURIComponent(document.getElementById("faddress2").value);
  34.         urlparams += "&city=" + encodeURIComponent(document.getElementById("city").value);
  35.         urlparams += "&state=" + encodeURIComponent(document.getElementById("state").value);
  36.         urlparams += "&zip=" + encodeURIComponent(document.getElementById("zip").value);
  37.         urlparams += "&os0=" + encodeURIComponent(document.getElementById("os0").value);
  38.         urlparams += "&email=" + encodeURIComponent(document.getElementById("email").value);
  39.  
  40.  
  41.         httpRequest.onreadystatechange = function() { alertContents(httpRequest); };
  42.         httpRequest.open('POST', url, true);
  43.         httpRequest.send('urlparams');
  44.  
  45.     }
  46.  
  47.     function alertContents(httpRequest) {
  48.  
  49.         if (httpRequest.readyState == 4) {
  50.             if (httpRequest.status == 200) {
  51.                 alert(httpRequest.responseText);
  52.             } else {
  53.                 alert('There was a problem with the request.');
  54.             }
  55.         }
  56.  
  57.     }
  58. </script>
  59.  
and this is the form....i have put the paypal link as a php comment so you can see the address the form submits to

Expand|Select|Wrap|Line Numbers
  1. <table width="675" border="0" align="center" cellpadding="0" cellspacing="0">
  2.                           <tr><? //https://www.paypal.com/cgi-bin/webscr?>
  3.                             <td><form action="" method="post" target="paypal" id="form">
  4.                                 <p>
  5.                                   <input type="hidden" name="on0" value="shipping To:" />
  6.                               </p>
  7.                               <table width="675" border="0" align="center" cellpadding="0" cellspacing="0">
  8.                                   <tr>
  9.                                     <td height="825" background="images/leadBox.jpg"><table width="550" height="133" border="0" align="center" cellpadding="0" cellspacing="0">
  10.                                         <tr>
  11.                                           <td height="40"><div align="center"><span class="style112">All fields marked with <span class="style114">*</span> are required and must be entered before continuing to the secured paypal payment page.</span></div></td>
  12.                                         </tr>
  13.                                         <tr>
  14.                                           <td height="25">&nbsp;</td>
  15.                                         </tr>
  16.                                         <tr>
  17.                                           <td><table width="490" border="0" cellspacing="0" cellpadding="0">
  18.                                               <tr>
  19.                                                 <td height="28" bgcolor="#666666"><span class="style118">...</span><span class="style116">Product Order</span></td>
  20.                                               </tr>
  21.                                               <tr>
  22.                                                 <td><table width="550" border="1" cellspacing="0" cellpadding="0">
  23.                                                     <tr>
  24.                                                       <td width="71" height="25" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Quantity</span></div></td>
  25.                                                       <td width="407" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Description</span></div></td>
  26.                                                       <td width="64" bgcolor="#CCCCCC" class="style96"><div align="center"><span class="style120">Price</span></div></td>
  27.                                                   </tr>
  28.                                                     <tr>
  29.                                                       <td><div align="center" class="style121">1</div></td>
  30.                                                       <td height="50"><table width="400" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
  31.                                                           <tr>
  32.                                                             <td><div align="left"><span class="style149">Adam Ginsberg’s ‘The Closely Guarded Secrets Of An eBay  Millionaire – Make Money On eBay’</span></div></td>
  33.                                                           </tr>
  34.                                                       </table></td>
  35.                                                       <td height="30"><div align="center" class="style121">
  36.                                                         <p>£97.00<br />
  37.                                                         (inc VAT)</p>
  38.                                                         </div></td>
  39.                                                     </tr>
  40.                                                     <tr>
  41.                                                       <td height="32">&nbsp;</td>
  42.                                                       <td><table width="400" height="28" border="0" align="center" cellpadding="0" cellspacing="0">
  43.                                                           <tr>
  44.                                                             <td><div align="left">
  45.                                                                 <p class="style121">Postage &amp; Packaging:<br />
  46.                                                                   <strong>Calculated via Royal Mail according to Country 
  47.                                                               of Residence</strong></p>
  48.                                                             </div></td>
  49.                                                           </tr>
  50.                                                       </table></td>
  51.                                                       <td height="32">&nbsp;</td>
  52.                                                     </tr>
  53.                                                     <tr>
  54.                                                       <td height="23" bgcolor="#CCCCCC">&nbsp;</td>
  55.                                                       <td bgcolor="#CCCCCC"><div align="right" class="style123">Sub-Total<span class="style124">..</span></div></td>
  56.                                                       <td bgcolor="#CCCCCC"><div align="center" class="style123">£97.00</div></td>
  57.                                                     </tr>
  58.                                                 </table></td>
  59.                                               </tr>
  60.                                           </table></td>
  61.                                         </tr>
  62.                                         <tr>
  63.                                           <td height="28" bgcolor="#FFFFFF">&nbsp;</td>
  64.                                         </tr>
  65.                                         <tr>
  66.                                           <td height="28" bgcolor="#666666"><span class="style118">...</span><span class="style116">Billing Information</span></td>
  67.                                         </tr>
  68.                                       </table>
  69.                                         <table width="550" border="0" align="center" cellpadding="0" cellspacing="0">
  70.                                           <tr>
  71.                                             <td bgcolor="#CCCCCC"><table width="475" border="0" align="center" cellpadding="2" cellspacing="2">
  72.                                                 <tr>
  73.                                                   <td>&nbsp;</td>
  74.                                                   <td>&nbsp;</td>
  75.                                                   <td>&nbsp;</td>
  76.                                                 </tr>
  77.                                                 <tr>
  78.                                                   <td><div align="left"><span class="style123">First Name: </span></div></td>
  79.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  80.                                                   <td><div align="left">
  81.                                                       <input type="text" name="first_name" value="" />
  82.                                                   </div></td>
  83.                                                 </tr>
  84.                                                 <tr>
  85.                                                   <td><div align="left"><span class="style123">Last Name: </span></div></td>
  86.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  87.                                                   <td><div align="left">
  88.                                                       <input type="text" name="last_name" value="" />
  89.                                                   </div></td>
  90.                                                 </tr>
  91.                                                 <tr>
  92.                                                   <td class="style123"><div align="left"><span class="style96">Address Line 1: </span></div></td>
  93.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  94.                                                   <td><div align="left">
  95.                                                       <input type="text" name="address1" value="" />
  96.                                                   </div></td>
  97.                                                 </tr>
  98.                                                 <tr>
  99.                                                   <td class="style123"><div align="left"><span class="style96">Address Line 2: </span></div></td>
  100.                                                   <td>&nbsp;</td>
  101.                                                   <td><div align="left">
  102.                                                       <input type="text" name="address2" value="" />
  103.                                                   </div></td>
  104.                                                 </tr>
  105.                                                 <tr>
  106.                                                   <td class="style123"><div align="left"><span class="style96">City: </span></div></td>
  107.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  108.                                                   <td><div align="left">
  109.                                                       <input type="text" name="city" value="" />
  110.                                                   </div></td>
  111.                                                 </tr>
  112.                                                 <tr>
  113.                                                   <td class="style123"><div align="left"><span class="style96">County/State/Province: </span></div></td>
  114.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  115.                                                   <td><div align="left">
  116.                                                       <input type="text" name="state" value="" />
  117.                                                   </div></td>
  118.                                                 </tr>
  119.                                                 <tr>
  120.                                                   <td class="style123"><div align="left"><span class="style96">Postal Code/Zip Code: </span></div></td>
  121.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  122.                                                   <td><div align="left">
  123.                                                       <input type="text" name="zip" value="" />
  124.                                                   </div></td>
  125.                                                 </tr>
  126.                                                 <tr>
  127.                                                   <td class="style123"><div align="left"><span class="style96">Country: </span></div></td>
  128.                                                   <td><span class="style112"><span class="style114">*</span></span></td>
  129.                                                   <td><div align="left">
  130.                                                       <select name="os0" id="os0">
  131.                                                         <option value="">Please Select ...</option>
  132.                                                         <option value="Albania">Albania</option>
  133.                                                         <option value="Algeria">Algeria</option>
  134. <!-- removed for better readability -->
  135.                                                         <option  value="Yemen">Yemen</option>
  136.                                                         <option  value="Zambia">Zambia</option>
  137.                                                       </select>
  138.                                                   </div></td>
  139.                                                 </tr>
  140.  
  141.                                                 <tr>
  142.                                                   <td class="style123"><div align="left">Email Address</div></td>
  143.                                                   <td><span class="style150">*</span></td>
  144.                                                   <td><div align="left">
  145.                                                     <input type="text" name="email" value="" id="email" />
  146.                                                   </div></td>
  147.                                                 </tr>
  148.                                             </table></td>
  149.                                           </tr>
  150.                                           <tr>
  151.                                             <td height="50" bgcolor="#CCCCCC"><div align="center">
  152.                                                 <input name="submit" type="image" onclick="CalculateOrder(this.form)" onmouseover="validate(this.form)" onsubmit="makeRequest('')" src="https://www.theauctionwinners.com/main/payment/images/paymentBtn.gif" alt="Continue To PayPal" width="152" height="50" border="0" />
  153.                                                 <input type="hidden" name="upload" value="1" />
  154.                                                 <input type="hidden" name="cmd" value="_cart" />
  155.                                                 <input type="hidden" name="business" value="john@future-resourcings.com" />
  156.                                                 <input type="hidden" name="item_name_1" value="Adam Ginsberg's The Closely Guarded Secrets Of An Ebay Millionaire - Make Money On eBay - FAST TRACK DVD Home Study Course (Inc VAT)" />
  157.                                                 <input type="hidden" name="quantity_1" value="1" />
  158.                                                 <input type="hidden" name="amount_1" value="97.00" />
  159.                                                 <input type="hidden" name="shipping_1" />
  160.                                                 <input type="hidden" name="item_number_1" />
  161.                                                 <input type="hidden" name="country" />
  162.                                                 <input type="hidden" name="currency_code" value="GBP"/>
  163.                                                 <input type="hidden" name="no_shipping" value="2" />
  164.                                                 <input type="hidden" name="return" value="http://www.theauctionwinners.com/main" />
  165.                                                 <input type="hidden" name="bn" value="TheAuctionWinners_ShopCart_WPS_GB" />
  166.                                                 <!-- Enable override of payer’s stored PayPal address. -->
  167.                                                 <input type="hidden" name="address_override" value="1" />
  168.                                             </div></td>
  169.                                           </tr>
  170.                                           <tr>
  171.                                             <td bgcolor="#FFFFFF"><div align="center"><span class="style125">I authorise Future Resourcings Ltd to charge me for the above sub-total and forthcoming postage &amp; package.
  172.                                               I further affirm that the personal information provided on this form are true and correct.</span></div></td>
  173.                                           </tr>
  174.                                         </table>
  175.                                       <table width="220" border="0" align="center" cellpadding="0" cellspacing="0">
  176.                                           <tr>
  177.                                             <td>&nbsp;</td>
  178.                                           </tr>
  179.                                           <tr>
  180.                                             <td><div align="center"><strong class="style112">By continuing to PayPal,<br />
  181.                                               I agree to pay Future Resourcings Ltd.</strong></div></td>
  182.                                           </tr>
  183.                                         </table>
  184.                                       <table width="300" height="38" border="0" align="center" cellpadding="0" cellspacing="0">
  185.                                           <tr>
  186.                                             <td>&nbsp;</td>
  187.                                           </tr>
  188.                                       </table></td>
  189.                                 </tr>
  190.                                 </table>
  191.                               </form></td>
  192.                           </tr>
  193.                         </table>
  194.  
May 7 '09 #45
acoder
16,027 Expert Mod 8TB
The reason it opens a new window is the target attribute. If you remove that, it won't open a new window. However, having said that, onsubmit should be added to the form tag, not the submit button. Remind me, did you want to prevent a page unload completely or did you want to make one submit (with Ajax) and then another page unload/reload one later with Paypal?

Note: 'urlparams' should be just urlparams without the quotes.
May 8 '09 #46
anfetienne
424 256MB
i just want to save the form data to a db whilst paypal opens in a new window....nothing to do with paypal is going to change, just need to be able to get it to send data to db in the same page or in a seperate page.

change httpRequest.send('urlparams'); to httpRequest.send(urlparams);
May 11 '09 #47
acoder
16,027 Expert Mod 8TB
I just noticed that when you call makeRequest(), you're passing an empty string instead of the URL.
May 12 '09 #48
anfetienne
424 256MB
ok so i have to take away the quotes on urlparams and makeRequest() should be makeRequest(url)?
May 12 '09 #49
acoder
16,027 Expert Mod 8TB
Yes and no. Pass the actual URL as a string, e.g.
Expand|Select|Wrap|Line Numbers
  1. makeRequest('test.php')
May 12 '09 #50

Sign in to post your reply or Sign up for a free account.

Similar topics

6
by: KDCinfo | last post by:
Although I'm making an ajax call, this is really a javascript question (although it could be even more of an HTML or DOM question... not exactly sure) I'm doing an ajax call to a remote php...
0
by: Free Ebooks | last post by:
81 AJAX and 24 JavaScript Ebooks Here are some of the AJAX topics and areas covered by these ebooks: Rails and AJAX Building Ajax Web Applications Creating Ajax Web Pages Ajax Patterns Ajax...
3
by: SM | last post by:
Hello, Im trying to access elements in my XML file using the JavaScript DOM but i'm not sure how. I use AJAX to access the XML and then use the responseXML property to access the XML file data. I...
2
by: Nathan Sokalski | last post by:
I am moving my website from my machine to my webhost, and need some help with what extra files I need to include due to the fact that I used AJAX in my site. Everything on the site is obviously...
10
by: paulie | last post by:
Hi, I have been experiencing an issue when trying to use AJAX to reload a DIV area using a timer of 2000ms, which contains a html page with another DIV and javascript. Scenario -------------...
1
by: jmohan | last post by:
Dear Sir/Madam, I develop a website in asp.net with c#. And also, I develop a toolbar in the toolbar studio separately. Aim of the Website: Enabling the visitors to become a member of our...
3
by: jarremw | last post by:
hello all, what i have is a modal popup control extender, i have an ajax script that saves the value of the two textboxes that are in the popup, what i am needing is a way to insert those values into...
84
by: Patient Guy | last post by:
Which is the better approach in working with Javascript? 1. Server side processing: Web server gets form input, runs it into the Javascript module, and PHP collects the output for document prep....
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.