Open kang1987 opened 10 years ago
There are several examples in this repo by contributors/users. Click this repo "Label" section and you can find some good answers + examples by their categories...
Anyway you can " bind "
additional text/strings with simplecart " beforeCheckout "
functions for form fields like so:-
javascript
..your code ..
extra_data:{
// grabs the "id=text" value
text:document.getElementById("text").value,
},
Then bind the `" id=text "` value to simpleCart before sending the `data(value)`:-
``` javscript
simpleCart.bind ( 'beforeCheckout' , function( data ) {
data.text = document.getElementById("text").value;
});
For post methods, echo
out the receiving end using $_POST['text']
to grab the values which is " 123 "
.
A working example would be here at http://blogrcart-mukabuku.blogspot.com/ . View the page source at the send order email form (checkout). The theme is using simpleCart 3.++ (think so. Hope it helps :-)
@irsah Im chinese , my english is bad, thank you very much for asking my question ,it is helpful !!!
@kang1987 your most welcome :-)
< input type="text" name="text" id="text" value="123" /> simpleCart({ checkout:{ type: "SendForm", url:"/Home/Mall/checkout", method:"GET", extra_data:{ text: ????? , }, }, }); How can i get the text's value by using simplecart?