title: How to POST HTML form data to .json file using $http.post() method using angular js and jquery?
body: <p>I am working on creating an embedded javascript application. For testing purposes, I want to create a input box in HTML and when the user enters their name in the box, a page should come up displaying what the user entered. further i want to post the name the user entered in a json file using $http.post() method. We have an embedded server which handles the POST request. But I am not able to post anything to the json file? </p>
  
  <p>This is my HTML file:</p>
  
  <pre><code>  &lt;html&gt;
      &lt;head&gt;
      &lt;title&gt;Client-Side Application Framework -- UserDetails&lt;/title&gt;
           &lt;link type="text/css" rel="stylesheet" href="css/bootstrap-3.3.5/bootstrap.min.css"/&gt;
          &lt;script type="text/javascript" src="libs/jquery-1.11.2/jquery.min.js"&gt;  &lt;/script&gt;  
          &lt;script type="text/javascript" src="libs/angular-1.2.16/angular.min.js"&gt;&lt;/script&gt;    
          &lt;script type="text/javascript" src="app.js"&gt;&lt;/script&gt;
      &lt;/head&gt;
  &lt;body ng-app="myApp"&gt;
  &lt;div ng-controller="myCtrl"&gt;
  &lt;form ng-submit="sendPost()"&gt;
      &lt;input ng-model="newName"/&gt;
      &lt;button type="submit"&gt;Send&lt;/button&gt;
  &lt;/form&gt;
  &lt;p&gt; Hello {{config.newName}} &lt;/p&gt;
  &lt;/div&gt;
  &lt;/body&gt;
  &lt;/html&gt;
  </code></pre>
  
  <p>This is my javascript file</p>
  
  <pre><code>angular.module('myApp', [])
  .controller('myCtrl', function ($scope, $http) {
      $scope.sendPost = function() {
      var configUrl = window.location.protocol + "//" + window.location.host +"/ext/hp/userdetails/cp/app-config.json";
       var data = $.param({
              json: JSON.stringify({
                  name: $scope.newName
              })
          });
      $http.post(configUrl,data).success(function(data, status, headers, config) {
              $scope.config = data;
          })
      };                   
  })
  </code></pre>
  
  <p>I need to post the data to app-config.json file and then retrieve the data I posted and display it in the browser.</p>
  
  <p>I have an empty app-config.json file.</p>