JSON does not send information to the specified web address

Attempting to send some data to the following URL: "

    $(function() {
             var frm = $(document.myform);
             var data = "?lm_po_id=154668&authentication=ThisisAuth&description=ThisIsDesc";//JSON.stringify(frm.serializeArray());

//var data = JSON.stringify(frm.serializeArray()); // Also attempted this

         alert(data + "I am ready to POST this:\n\n" + data);
         $.postJSON = function (url, data, callback) {
                $.ajax({
                    'url': frm.attr("action"),
                    'type': 'post',
                    'processData': false,
                    'data': JSON.stringify(data),
                    contentType: 'application/json',
                    success: function (data) { callback(JSON.parse(data)); },
                });
            };
     });

The function is called correctly, but all parameters appear as null values when checked in debug mode. Can someone please assist me in identifying what mistake I am making? Here is my HTML form

<form action="http://192.168.0.124:8080/Ilex-WS/service/ilexmobile/poImageUpload" name="myform" method="post" enctype="multipart/form-data">
    <input type="text" value="158664" name="lm_po_id" /><br />
    <input type="text" value="AuthCodeMD5" name="authentication" /><br />
    <input type="text" value="584" name="imagenumber" /><br />
    <input type="text" value="ImgName.png" name="name" /><br />
    <input type="text" value="This is desc" name="description" /><br />
    <input type="file" value=""  name="uploadedimage" /><br /> 
    <input type="button" value="Submit" onclick="javascript:document.myform.submit()"/><br />
</form>

Appreciate your help in advance....

Answer â„–1

The primary purpose of your JavaScript code is to display an alert message.

There is no event handler attached to the form's submit action, and even if it was, it wouldn't trigger because you are using form.submit() instead of a submit button. This results in submitting form encoded data rather than JSON encoded data.

You define a function within $.postJSON, but it is never invoked, and it contains a local variable named data which overrides another variable declaration var data = "?lm_po.... Furthermore, passing this value through JSON.stringify doesn't serve any logical purpose.

Similar questions

If you have not found the answer to your question or you are interested in this topic, then look at other similar questions below or use the search

A guide on transforming JSON data into HTML using Rails

I'm struggling with parsing JSON on a webpage. My webpage is designed with circles, where clicking on a circle triggers a call to the controller to retrieve specific information from a database and display it as graphs and text. The issue I'm fa ...

Include an item in a JSON structure

I have a settings.json file that contains the following data (where 123456789 represents a unique user id): { "123456789": {"button_mode":true} } My goal is to add a similar id: {button_mode: value} object to this JSON file if there is no existing en ...

Extracting information from JSON using Python's string manipulation techniques

Having trouble parsing a JSON document in Python, everything is working smoothly except for converting a GPS string into the correct format. The string I have looks like this: "gsx$gps":{"$t":"44°21′N 68°13′W\ufeff / \ufeff44.35°N 68.21 ...

Navigating a JSON object with Coffeescript iteratively

I'm a beginner in Coffeescript and I'm facing a challenge with resolving an issue. Currently, I have a JSON object stored in a variable. Can somebody guide me on how to loop through the keys in the JSON object to show both the key name and its co ...

Arranging sequence of jQuery functions

I have implemented a loop using jQuery that iterates through specific elements on an HTML page. During each iteration, I switch over a variable and add HTML code to particular locations. The issue arises when one of the appends requires importing another ...

Determine the number of elements located inside a designated slot

Take a look at this Vue component code: <template> <!-- Carousel --> <div class="carousel-container"> <div ref="carousel" class="carousel> <slot></slot> </div> </div&g ...

Passing a PHP variable between PHP files with the help of jQuery

I'm facing a minor issue. I'm trying to pass a PHP variable from one PHP file to another using setInterval. However, I'm unsure of how to include the PHP variable in my jQuery code. Here is the content of first.php: <?php $phpvariable= ...

Error in Angular multiselect dropdown: Unable to retrieve the length of undefined property

counter: number = 0; getDatatypes(){ if(this.counter == 0) { if(this.appId != 0) { if(undefined != this.datatypes && this.datatypes.length) for (let i = 0; i < this.datatypes.length; i++) { this.ap ...

Implementing Dynamic Weight-based Pricing with CodeIgniter and AJAX

My shopping cart website utilizes ajax and Codeigniter to add products without reloading the page. Originally, I displayed a single net weight for each product. However, I recently switched to multiple net weights for the same product. Unfortunately, I am ...

I'm interested in knowing if it's feasible to develop unique jQuery selectors that can navigate ancestors, such as a :closest or :parents selector

As a developer who frequently creates jQuery plugins, I often find myself using custom jQuery selectors like :focusable and :closeto to simplify common filters in my code. For example, the :focusable selector is defined as follows: jQuery.extend(jQuery.e ...

Infinite scrolling with Jquery: Loading dynamic content seamlessly from external websites

Hey there! I recently started using this cool jQuery plugin called jquery-endless-scroll. Here's a snippet of my code: $(function() { $('#list').endlessScroll({ pagesToKeep: 10, fireOnce: false, insertBefore: "#list div:first ...

Testing the onClick event in React components using unit testing

I'm facing an issue with testing a Button wrapper component that utilizes a material-ui button. I tried writing some test code, but it's failing when trying to test the onClick event. index.tsx (ButtonWrapper Component) import React from &ap ...

Animating CSS using JavaScript

Recently diving into the world of JavaScript, I've taken on the challenge of creating an analog clock. I began by crafting the second hand using CSS but now I'm eager to transition it to Javascript without relying on jQuery or any other JS framew ...

Identifying the relationship between child and parent components in Vue.js

I am new to Vue.js and I am practicing some simple exercises on communication between Vue components. However, I am struggling with understanding who is a child component and who is a parent component. For example, consider the following code snippet: HTM ...

encountering a glitch while using console.log(util.format

Let me start by saying that I am fairly new to working with node.js. A friend of mine assisted me in writing the code snippet below. I have successfully installed the necessary packages search-google-geocode, csv-parser, fs, util, and async using npm. H ...

What is the best way to dynamically pass JSON object values to PHP?

Greetings, I am new to JSON and Ajax. Although my question may seem trivial, I believe that even the simplest inquiries are crucial in the learning process. My dilemma involves passing two parameters (giorno and periodo) via Ajax: For example: 'gior ...

gulp - synchronized gulp.pipe(gulp.dest) execution

Here's my challenge: I have two tasks, where Task B depends on Task A. In Task A, one of the requirements is to loop through an array and then use gulp.dest, but it seems like Task B will be executed before Task A is completed. The main goal of Task ...

"The interconnection between NetBeans, jQuery, and AJAX is

My issue is with a Netbeans 7.4 (also tried 7.3) project involving PHP and JavaScript where breakpoints do not work in jQuery ajax loaded pages that contain included JavaScript. I have no problem with PHP or top-level JavaScript, but for example: In index ...

Encountering a 500 internal server error while accessing the web server

Anyone out there able to assist? My web service seems to be throwing an error. Receiving a 500 Internal Server Error and 304 Not Modified message The requested XML data is not displaying the body content as expected. var soapMessage ='<soap:E ...

The Google Books API has reached its limit for requests

Encountering a rate limit exceeded error from the Google Books API while using this demo: To reproduce, open the developer console in Chrome and perform some searches. The rate limit errors will be displayed in the console. [],"lazyUpdate":null},"status" ...