View Full Version : create element and include div by reference of classname not working in post

12-11-2011, 06:12 AM
I don't receive any server errors. :confused:
The applet i'm using uses class names as id's. In this case the id is " class="storeCart_items ".

Store cart items loads all the user selections from the cart script into the <div class="storeCart items"> stuff loads here dynaically from user choice<div>. IE: their product selections with price and details.

The email function that loads the user selection and passes it to the email.php to post works on its own without the two lines of code.

var div = me.updateCartView( document.createElement("div") );
div = '<div class=\'storeCart_items\'> + div.innerHTML + </div>';

If i add these two lines of code: The script just hangs but if i comment out some parts the script posts but it posts the words \" +div.innerHTML+ \" and not the items of the user selection.

//her is snipet from the code:

me.emailCheckout = function() {
var div = me.updateCartView( document.createElement("div") );
div = '<div class=\'storeCart_items\'> + div.innerHTML + </div>'; [ICODE]
var buyersalute = jQuery("#buyersalute").val();
var buyerfirstname = jQuery("#buyerfirstname").val();

[ICODE]The me.updateCartView is a function that updates the cart when the user selects items. this function works.

var datastring = 'div=' + div + '&buyersalute=' + buyersalute....... // this is how the string is passed

//and the post method and criteria here.

if i add comments to ms'>\" +div.innerHTML+ \"</div>"; the email script does not hang but the post for items shows as:

<div class=\"StoreCart_items\">\" div.innerHTML \"</div>Success!

instead off the actual items.

12-11-2011, 07:20 AM
I finally got a result that differs from the previous results:
When i do a echo i get this result:
I changed the code to this:

var newdiv = document.createElement("div");
div = "<div class=\'StoreCart_items\'></div>";
var diver = me.updateCartView( "newdiv" );

and my post datastring looks like this:
var datastring = 'diver=' + newdiv + '&bu....

[object HTMLDivElement]
instead of the items in the cart.

my previous result:
<div class=\"StoreCart_items\">\" div.innerHTML \"</div>Success!

How can i make this work?