Jump to content

Funce

Moderator
  • Content Count

    451
  • Joined

  • Last visited

  • Days Won

    15

Funce last won the day on December 9

Funce had the most liked content!

Community Reputation

34 Excellent

2 Followers

About Funce

  • Rank
    The Lookout
  • Birthday April 24

Previous Fields

  • Languages
    HTML, CSS, JavaScript, PHP, SQL, BYOND(DM)

Profile Information

  • Location
    New Zealand

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

  1. There isn't very many specifics here. I wouldn't be able to advise exactly. The possibility of this will depend on how well documented the supplier api you wish to use.
  2. Yes indeed, checkboxes only send data when checked. Glad I could help.
  3. Name attributes on your inputs. That's the only way the data can be retrieved in the FormData. I can see one textarea has one 'title1' which is why you can probably see that one.
  4. Nope, it's really bamboozling, but leaving the order as it is, and adding the ajax options will help.
  5. In addition, to fix the issue with the data capture, you need name attributes on all of your inputs.
  6. Maybe the ajax request is preemptively modifying the formData object, I have no idea. But I do know that adding the ajax options fixes the append error.
  7. I think the two might be linked. The append call may be surrounding the .ajax request.
  8. Also you'll need to add some additional options to the ajax request. Sorry, I missed them before $.ajax({ type: "POST", // define the type of HTTP verb we want to use (POST for our form) url: "./_utilities/php/student_info.php", // the url where we want to POST data: formData, // our data object processData: false, contentType: false })
  9. Has your FormData object been initialised as below? var formData = new FormData($("#student_info")[0]);
  10. Hiya Roddy, Please view below, the data aggregation and subsequent form submission. $(".SignUpButton").click(function() { //Build the formData payload var formData = new FormData($("#student_info")[0]); var poData = $("#topic_info").serializeArray(); for (var i = 0; i < poData.length; i++) formData.append(poData[i].name, poData[i].value); //Now send it $.ajax({ type: "POST", // define the type of HTTP verb we want to use (POST for our form) url: "./_utilities/php/student_info.php", // the url where we want to POST data: formData // our data object }) .done(function(data) { //Redirect here? }) .fail(function() { //Error message if you'd like }); });
  11. Hi there Roddy, If you want to post two sets of data, you'll probably want to use an AJAX request. Stand by, I can also get you the grouping code for submission of two forms as well. Hang in there.
  12. What do you expect it to show?
  13. What tutorial are you following? What code are you running? (Is the text white on a white background?)
  14. So, uh, I did a bit of digging to look into this, and it seems that setItem stores a string, so getItem returns a string and a non-empty string is always truthy. Dang it. If you change the getItem code to the following var element = document.body; if (localStorage.getItem("changeMode") == "true") { //dark-mode is on element.classList.add("dark-mode"); } You should have a bit more luck with this.
  15. I should specify that the two sets of code should be separate, though I do notice an error in the code that I gave you (apologies for that) I'll do my best to clarify. So my changeMode function should still be accurate, just need to move the changeMode Loading This should be your program flow Page Load Load the value of changeMode Press Change Mode Button Toggle Class Save value of change mode And I'll amend my code to be correct. var element = document.body; if(localStorage.getItem("changeMode")) { //Note getItem rather than setItem //dark-mode is on element.classList.add("dark-mode"); } //If dark-mode isn't on, the natural state of the page //doesn't need to be changed. Now the code above needs to be run when the page loads, are you able to figure that part out? In addition, you can use the Forum's Code Block feature to post snippets of code so that they are readable. Check it out.
×
×
  • Create New...