1

Is it at all possible to post HTML to an HTML file using jquery's post method.

for example:

$.post("database.html", "<div>Content</div>")

once a button is clicked I want to post to the database file and have this current file load in content from the database file using.

$.load("database.html")

Does anyone know how I could implement this method properly?

Maistrenko Vitalii
  • 994
  • 1
  • 8
  • 16
LuckyPants
  • 123
  • 1
  • 9

2 Answers2

1

If I rewrite your question a bit: you want to pass data between two html pages. If you only use static html you cannot do that with javascript only. You have to send the data to a server and then use this data in your second html file.

But I think you quite misunderstood what http can or cannot do, I would recommend reading mozilla explanation

Merlin
  • 224
  • 1
  • 11
0

It is possible to pass HTML content in POST from one HTML page to another. But in order to use or process received the data at the second HTML page, you'll need a programming language.

Read the accepted answer to question How to read the post request parameters using javascript.

Roshana Pitigala
  • 8,437
  • 8
  • 49
  • 80