Jump to content

using javascript to post to php file to update database - IE issue


Go to solution Solved by apicton,

Recommended Posts

Hi all- this is my first post here, I've been working with javascript for only a few months and can usually find the answers by googling, but I am kind of stumped on this one. 

 

I have a form where I can select toppings for a pizza and when you change the dropdown selector to choose a topping, a javascript function posts to a standalone php file to automatically update the database. It works great in chrome, but I can't seem to get it to work in IE. 

 

If I run the standalone script directly in a browser window, it works, even in IE. So I am assuming that my javascript code that posts to the file is not able to post to the file in IE for some reason. 

 

Here is the js function trying to post to the form:

function updateCart() {
    var filename = "<?php echo $server;?>update_cart.php";
  $.post(filename, $("#cartform").serialize());
  alert("file name: " +filename);
}

The alert pops up and correctly displays the path to the file in both chrome and IE. 

 

Does anyone see any obvious reasons why this wouldn't work in IE?

 

thanks for your help,

Andy

 

 

  • Solution

ok, I figured it out. Thanks anyhow...

 

I guess I didn't need to add the whole server part of the file when posting to it, and for some reason IE didn't like it. So i changed my function to the following and it worked:

function updateCart() {
    var filename = "update_cart.php";
  $.post(filename, $("#cartform").serialize());
  alert("file name: " +filename);
}
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.