Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 6 years ago.
Improve this question
Both file are html, index.html and show.html, in index.html i have a very basic form with a single input type="file", when user selects a file(only images) it shows a preview, when user clicks on "send" the user goes to the show page and I want to show on that page the image that was "uploaded", but since no images are uploaded because is just a demo with no actual uploading functions how do I show that image?... the jquery library that I use to preview the image in index.html converts the image in to a base64 code I'm able to get that value, but in show.html I can't use POST, and using ajax is out of the question, i was thinking to use:
document.getElementById("posted_image").innerHTML = window.location.search;
then just parse the value, but the problem is that the base64 code of that image is humongous it wont work... also I was thinking to store the value in a cookie but I don't know how to do that with javascript or if a cookie has a limitation... is there an actual way of doing this without the use of PHP?..
first you should convert the image into base64 as you did already so if you have value then use localStorage to store the image
localStorage.setItem("base64mgData", base64mgData);
here is the stackoverflow link
Related
Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
what i need is a system that will let me send some data when a user clicks a link.
for example, if i had an html or javascript file that would display a color depending on data it gets, and the link you click to get there sends the data to that site that determines the color (sets a variable in javascript, or something like that).
i havent tried anything yet since i am new to html and have no idea how to do things that involve interacting scripts. i have looked at github projects with the results i want that use a '#' in the url
You can send the color you want the other site to show in a GET parameter.
E.g, your anchor could look something like this:
Red
Then, on site.com/page, you can use JavaScript to get the color parameter value:
const color = new URLSearchParams(window.location.search).get('color')
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
On my website, I have several links as my table of content
<li>Ch. 1 - TitleHere</li>
<li>Ch. 2 - TitleHere</li>
<li>Ch. 3 - TitleHere</li>
I want to send get request (using js) to those anchor texts for checking whether the link inside 404 not found or 200 ok. and if it is 404 not found, I want its style to change. Let just assume its style to change in color.
how do I do this?
You can achieve that by using JS fetch. But first you have to use selector to get value of the href attribute. Then forEach of them, you may want to create a fetch request and get a response. With returned response.status attribute, you can continue to next step. More information about fetch can be found here
You can check the given link using ajax in window.onload. Check the corresponding request and configure style according to it.
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
Is it possible to copy the query of a form, which is using GET method, to the clipboard?
My aim is to have a button, which when pressed should copy the value in the black box to the clipboard so it is easily shared with someone else.
Edit: Not just asking about copying something into the clipboard, I am also asking about how to get the value of the GET query..
The GET parameters are only added to the submitted URL at the moment where the button is pressed, i.e. the form is submitted, so I don't think that 's possible directly (i.e. retreiving a value from the submit button)
But you could use a plugin like https://clipboardjs.com/, "collect" all the form data via JS and combine them together with the initial URL for its return value including the GET data.
this might help
var path = location.href.replace(/[^\?]+$/,$('form').serialize());
var cpy = $('input#cpy').val(path);
cpy.select();
document.execCommand('copy');
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I am trying to find out how I can make a program in JavaScript/HTML that takes a user's input and automatically enters this information onto a different web page. I am new to JavaScript/HTML so any help would be appreciated!
You specified the website as:
Supreme
Now, when you go to checkout, right click and click Inspect Elements. Then find all of the input fields on the website. For example, I found the Full Name input field. The field has a name: order[billing_name]
What you want to do next is in your URL do something like this:
https://www.supremenewyork.com/checkout?order[billing_name]=yourname
Now if you want multiple values (most likely) you need to find the names of the other fields and add the values to the URL, as so:
https://www.supremenewyork.com/checkout?order[billing_name]=yourname&order[email]=youremail
This way you can pass the values from your application and fill in the form on that website.
Hope this helps.
Use localstorage. see working demo in the link below;
Note: localStorage won't work in snippet; hence I made a fiddle.
Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 7 years ago.
Improve this question
I've got a setup of HTML, PHP & jQuery. The steps I want the user to take are as follows:
Click a button
Modal Appears with dynamic data (taken from button markup, parent div etc.)
User Submits Modal & Close
I have two options. To:
Generate the HTML prior the user clicking the button. With PHP & Just hide it & then manipulate it with jquery once clicked.
Request the the HTML on click via Ajax using an API & again manipulate it with jQuery.
My question is. From the two options which would be the best for performance?
Reading through this and documenting my logic. I'd say that point 1. would be best as I'm not requesting a large amount of data through the API every time?
Can anyone see any advantages to number two? Apart from not requesting the data server side on page load?
Thanks.
I think the main question here is "how dynamic is the information used to produce that HTML ?".
If there isn't any high probability that the information used to produce that HTML could change at any time, then you should better off with 1st option, since therefore you will be avoiding an additional request to the server.
If the information used to produce that HTML could change at any time, that would be the reason to use the 2nd approach.