Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8740069
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 13, 20262026-06-13T11:03:54+00:00 2026-06-13T11:03:54+00:00

I have a basic form with some input fields. I want to save the

  • 0

I have a basic form with some input fields. I want to save the form data into a json file on submitting the form.
The format of the saved data in the json file should be like this.

[
    {"title":"some text","description":"some text","info":"some text","username":"some name"},
    {"title":"some text","description":"some text","info":"some text","username":"some name"},
    {"title":"some text","description":"some text","info":"some text","username":"some name"}
]

I tried doing this by using this code, but no data is saved in my ‘story.json file’

$('form').submit(function() {
    $.ajax({
       type: 'POST', 
       dataType: 'json', 
       url: 'story.json', 
       data: $(this).serialize(), 
       success: function(data) { 
           alert(data.message); 
       },
       failure: function (data) {
           alert('Please try again');
       }
    });
 });

I want to save this form data on my local file.
Please help me to find the correct way of doing this. Thanks

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-13T11:03:56+00:00Added an answer on June 13, 2026 at 11:03 am

    You need to post data to a simple php file…

    like url: 'story.php'
    In that php file create a ‘story.json’ using fopen and store that json

    EDIT: if you want to use serialize() than use someting like this

    data:{'mydata':$(this).serialize()}
    

    and in php file

    parse_str($_POST['mydata'],$newarray) ;
    
    echo json_encode($newarray);
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a basic PHP form (a few fields and 2 checkboxes, I want
I have a basic html form that adds some data to the page using
I have a basic form with a search input and a submit button within.
I have just a basic html form within index.php which contains two text fields:
I have a basic unordered list with an input field/form below it. I would
I have really basic question. How can I get form id by input element
I am doing some basic form validation. I have the following JavaScript function: function
I have a view which validates data from a form which just has some
I’m using jQuery Validate for my site’s contact form. The input fields have pre-populated
I have a basic form that asks the user to enter some text in

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.