Please avoid or flag spams/hateful comments. And do not spam. Enjoy 🙂
Latest JQuery Link:-
Subscribe my Channel:-
Hey guys, this is UNPOSSIBLE POG.
In my case, the backend language is PHP.
The main reason to use this code is when client gives some static table which is vary large that it will take a lot of time to insert into database table one by one.
Let’s get started.
First requirement is to add ajax jquery link in code.
As you can see, I already created a sample table.
Table’s id will be “mytable”.
Lets create a script tag, and call the function onclick event of button.
Let’s verify if it is working.
Now, the main challenge is to find how many rows and columns are present it table.
Now, we are using jquery syntax to find jump to each “tr” tag.
The second task is to find how many columns are there in each row.
So type this code.
We are finding each column, then jump in each column by using each function.
Now, we are table to get each value within each column.
Now, we have to make a JSON of each value by appending a string.
We are getting tr and td count.
Lets make only two columns in second row.
We get two in second output so we are on right track.
We have to carefully make json as single mistake destroys JSON structure.
We put count of each columns in the beginning of JSON.
Let’s put that outside.
We shall separate it by commas.
Also, we have to make teach tr with unique id to avoid conflict.
Now, each tr have their own array.
Now we are going to add the data in each column.
We have completed the task of creating a JSON. Now the next task it so send those values in URL.
As you can see, I already created a file which decodes the JSON data.
Let’s run it.
As you can see, the data is coming.
Now lets test the code by increasing the data.
Although the task doesn’t end here. The special character called “ampersand” creates a problem while sending data.
Lets add ampersand.
You can see, ampersand is automatically converted into this, and it is creating a problem.
The solution is very easy.
We have to replace ampersand with ‘%26‘
Don’t give any quote in pattern.
And as you can see. The data is submitted.