I want to send json data to ajax but how do you convert variables into json or convert an array to json? Answer If you really want to convert the data into JSON, you have to create an object or array and use JSON.stringify (available in newer browser and can be loaded form here): but you cannot just set the
Tag: jquery
Javascript Hanging UI on IE6/7
Could anyone suggest performance improvements for the function I’ve written (below, javascript with bits of jquery)? Or point out any glaring, basic flaws? Essentially I have a javascript Google map and a set of list based results too, and the function is fired by a checkbox click, which looks at the selection of checkboxes (each identifying a ‘filter’) and whittles
JQuery Error: Uncaught TypeError: Object # has no method ‘ready’
my site is getting the error in this title in the javascript console. Google seems to say that it is because jquery isn’t loaded, but it is definitely visible in the head. the site is medical marijuana related, so nsfw for some.sorry for the messy head, it’s in dev mode. http://www.kindreviews.com/1/mmc/ Thanks, zeem Answer Apparently you are using both jQuery
Disable submit button on form submit
I wrote this code to disable submit buttons on my website after the click: Unfortunately, it doesn’t send the form. How can I fix this? EDIT I’d like to bind the submit, not the form 🙂 Answer Do it onSubmit(): What is happening is you’re disabling the button altogether before it actually triggers the submit event. You should probably also
PO Box Regular Expression Validation
Here’s my code, but I can’t ever trigger the alert. Answer In javascript, you have to escape your slashes: Also, you could reduce your pattern a bit by using case-insensitive matching: Note: Your regex also matches on addresses such as: 123 Poor Box Road 123 Harpo Box Street I would suggest also checking for a number in the string. Perhaps
strip decimal points from variable
I have a series of variables that have a decimal point and a few zeros. How do I strip the variable so it goes from 1.000 to 1? Answer Simply… …assuming you want to round 1.7 to 2. If not, use Math.floor for 1.7 to 1.
Best practice for triggering events on calling page from an ajax page
I have a page that lists a bunch of files. This page can be accessed directly via a URL or it can be loaded in a modal dialog via ajax from a different page. If the files page is loaded via ajax, I would like to allow the user to click the name of the file and trigger an action
Convert to uppercase as user types using javascript
I want to convert lowercase chars to uppercase as the user types using javascript. Any suggestions are welcome. I have tried the following: Answer
How to wait until an element exists?
I’m working on an Extension in Chrome, and I’m wondering: what’s the best way to find out when an element comes into existence? Using plain javascript, with an interval that checks until an element exists, or does jQuery have some easy way to do this? Answer DOMNodeInserted is being deprecated, along with the other DOM mutation events, because of performance
Problems dynamically adding to form (trying to use onChange and appendTo)
I want my form to extend in different ways depending on the selection of a drop down box. I have got my JavaScript working so that onchanging my selection it will carry out something. But I am trying to use the appendTo() method as I have used before; for adding a single input, to work for implementing a div and