需要知道如何将用户名,标题和formImg的信息从handleFormSubmit传递到addNewPost
function handleFormSubmit(event) {
// This next line prevents the reload of the form
event.preventDefault();
// Get values of inputs
// Pass values to addNewPost()
var username = document.getElementById("formUsername").value;
var caption = document.getElementById("formCaption").value;
var formImg = document.getElementById("formImg").value;
function addNewPost(username, caption, imgLocation) {
}
答案 0 :(得分:2)
您可以在void tradeCards(vector<Card> &deck){ };
函数内调用addNewPost
函数,并可以传递值。
handleFormSubmit