Im creating a customization web application. Users can customize and save builds. Be able to retrieve builds from their account page.
HTML image Elements with IDs Act to trigger visibility of elements on the page.
eventHTMLElem('click', 'small-switch-toggle', true, function(event) {
changeVis(["GROUP", "Selector Switch - 3 pos"], true);
changeVis(["GROUP", "I 0 II - small handle"], true);
changeVis(["GROUP", "shroud-pull-to-release"], false);
changeVis(["GROUP", "led-button"], false);
changeVis(["GROUP", "push-button.001"], false);
});
create an array of html ids when img tag is clicked.
var array = [];
$('img').click(function(){
var id = $(this).attr('id');
array.push(id);
});
Now here is where the problem lies, im attempting to convert the array into php and post it to the WordPress database.
$('#sendQuote').click(function() {
$.ajax({
url:"readJson.php",
method: "post",
data: { myBuild:array },
success: function(res){
console.log(res);
}
})
});
readJson.php File
<?php
print_r($_POST);
?>
Once submitted to the database, the user can then access their builds in the my account page. The result is the web page loads with the saved array and fire a click command on each array item to set the visibility of the elements.