i know how to send post forms and process it server side with php… something like i am just developing it on my php server… the actual form has many more inputs and later i have to flash into an embedded system, so to make it more efficient (memory usage, responsiveness, etc) i decided to do it with AJAX… to
Tag: javascript
Combine JSON objects bases on the same value
I’m looking for a way to combine JSON objects if they have the same address value in them. Building off this Combining JSON Question I have these two sample JSON files. Would love any suggestions thank you so much. Before Combining: After Combining: Sample Code: Answer This solution uses: reduce to create a map of addresses, that contains maps of
ReferenceError: FileReader is not defined in Next.js
I am trying out the new functions of Next.js 13 with the /app folder, but in a simple client-side component that handles an input form, I am trying to use FileReader but receive an error when browsing. This is the summary of the code: Error: What am I doing wrong? Answer Like accessing window, any browser-specific code in Next.js needs
Updating state using api in useLayoutEffect does not work before painting component
The getUser method exists for API calls. I am trying to display the user profile when the user refreshes the website. That’s why I used useLayoutEffect because I wanted to update the globalUser state before painting and then show it when the web page is painted. But the globalUser state value is null when I refresh the page, then quickly
why can’t access the function inside the listener
I am using a class component. When I run this script, it plots the graphic, but in the next line when it calls the function computePM_from_ClickedPoint, I get the error below. The error refers to “this”, but without it, I cannot call the function. Suggestions? Error: Cannot read properties of undefined (reading ‘computePM_from_ClickedPoint’) tried unsuccessfully changing the call to: Answer
How can I position my autocomplete box under the search box?
Hello I’m trying to create a custom suggestion box for search box. The parent div is flex box and suggestion box is positioned absolute. but the top and left property of css. It is taking of global page and not parent. You can see in css “suggesetionbox” the top property is targeting complete page not parent div. Can someone suggest
How to generate a static website out of Sveltekit official RealWorld example for hosting on google firebase?
https://realworld.svelte.dev/ is the official example of SvelteKit. https://github.com/sveltejs/realworld is the codebase for this official example. I am trying to generate a static site so I can host this on google firebase. I updated config as content of file svelte.config.js is Content of file src/routes/+layout.server.js is When I am trying to build using command npm run build I am getting error
How can I set a default value from useSelector (React-Redux) if the state is compiling too slowly?
I’m making an educational program with React-Redux and I’m trying to make a form with items that appear and are removed sequentially. So users enter an initial observation for a reaction, click submit, the initial observation box disappears and a new button is enabled which means the user can click on a test tube and see a colour change, etc.
use regex to detect if a string contains two newlines
I have some text in a html page which is generated from a mysql query and it includes newlines. Im able to show the newlines in the HTML by using the <pre> tag. This enables the text to show each paragraph without need to use <p> tags. Now I would like to programmatically (using javascript) emphasise the first paragraph by
Unpredictable state change
I am dynamically creating mathlive fields and adding them to the DOM. Though it isn’t a good way but doing it like this because I wasn’t able to add the element as a React component and I needed a workaround quickly Now when I remove an element from array responsible for rendering the elements, it works as expected but when