jquery

Securing JSONP?

Hi, I have a script that uses JSONP to make cross domain ajax calls. This works great but my question is, is there a way to prevent other sites from accessing and getting data from these URL's? I basically would like to make a list of sites that are allowed and only return data if they are in the list. I am using PHP and figure I might ...

Unable to get JQuery to return AJAX data

I'm relatively new to JQuery, so before I try to build the actual app, I'm trying to build a simple Ajax script that'll simply return the data. However, despite more or less copying and pasting the code, I still can't get it to work. <html> <head> <title>This is a title!</title> <script src="scripts/jquery-1.4.2.min.js" type="text/jav...

Jquery: get the TOP and LEFT coordinates of the 5th paragraph?

I need to get the TOP and LEFT coordinates of the 5th paragraph on my page, or maybe the 6th paragraph, or the 8th, im just trying to figure out how to get the coordinates for any paragraph on the page I choose. I then need to insert a div 20px to the left of the top left of the paragraph i choose. Can anyone help? ...

Executing a jquery function to all href attributes

function openFile(file) { var extension = file.substr( (file.lastIndexOf('.') +1) ); switch(extension) { case 'jpg': case 'png': case 'gif': alert('was jpg png gif'); break; case 'zip': case 'rar': alert('was zip rar'); brea...

Jquery issue in ready handler

I have a very strange issue with a simple set of jquery stmts. I have the following in my jsp $(document).ready(function() { alert("in doc ready"); $("input[name='receivingOption']").each(function() { alert($(this).val()); if($(this).val() == $("#deliveryMethod").val()) { alert($("#" + $(this).attr("id") + "label").att...

jQuery inserting element .before() and .after() does not work as expected, what am I doing wrong?

I am trying to dynamically surround sets of IMG and A tags with a div tag but am unable to make it work. my html: <img class="myClass-1" src="img5" /> <a class="myClass-2" href="url"></a> my script: $('img.myClass-1').each(function(){ $(this).before('<div style="position: relative;">'); $(this).next().after('</div>'); ...

Simple jQuery css background "chooser" problem

Hi, I wrote this very simple backgroung chooser. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="http://aj...

How can I send XML data format from browser to server using jQuery?

Hi, I would like to know if there is a way in jQuery to send data to server from a browser in XML format? Thanks, Sana. ...

Javascript Execution Through Python

I am attempting to create an html document parser with Python. I am very familiar with jQuery and I would like to use its traversing functionality to parse these html files and return the data gathered with jQuery back to my Python program. Is there any way to use javascript scripts through Python? Or is this just a pipe dream? ...

Pros and Cons of Class Creation Script in Javascript?

Hi, I recently wrote a class creation script (with the help of Crockford's and Resig's code for certain parts) that automates certain tasks such as: merging defaults with passed in params, requiring params, creating a bridge between DOM and class instance, binding custom events with a common namespace, inheritance with access to super m...

Delay jQuery effects whilst page is loading

I have this bit of code: $("#comingsoon, #1, #2, #3").hide().each(function(i) { $(this).delay(i * 500).slideDown(1500); }); Which basically fades in a series of objects on my page, problem is that the animation lags horribly when the flash banner at the top of the page is loading. I would like to delay the entire jQuery animation ...

hide url hashtag with jquery

Hi to all. I need the code to hide the hashtag in the url in jQuery; I'm working on a OnePageSite and I wish to obtain "www.mysite.it" and not "www.mysite.it/index.php#hashtag" when clicking on a link. This is a piece of code for Mootools 1.x; is there a way to make the same with jQuery? Thank you in advance. Best regards. if(window.loc...

How to empty TINYMCE content after ajax action with jquery.

I add contents in some input fields and textarea with jquery ajax function. Only textare uses TINYMCE. However after ajax, the text in TINYMCE does not refresh and remains. How can I empty content in TINYMCE with jquery? My current code it following. //on submit event $("#specformentry").submit(function(event){ event.pr...

How do I select everything before Picture_1.png with JS?

I am trying to figure out how to select with JS everything before Picture_1.png in this url: "http://s3.amazonaws.com/hq-photo/development/system/photos/215/cropped_thumb/Picture_1.png" so that the end result is this : "http://s3.amazonaws.com/hq-photo/development/system/photos/215/cropped_thumb" ...

jQuery removeClass duration not working?

I have a paragraph set with the following style: .design_info_box p.design_info_desc { height:30px; text-overflow: ellipsis; overflow:hidden; } With this, you can see the first 2 lines of text with a button to "read more" which expands the paragraph to show the rest of the text. Here is the code for the button: $(".read-...

How to drag div into boxes

I have the follow code that allows me to drag a div into 3 boxes. I am trying to get the draggable div to fit in the box from onces you dropped on to it, Because at the moment it will drop onit it but it allows it to be dropped anywhere on the window how can i stop that from happening? <div id="drop1" class="dropzone">Accepts the eleme...

JQuery Netflix style tooltips?

I'd like to have a tooltip (preferably using a jquery library) that allows me to pop open a div (who's content I can customize with html - forms, links, images etc.) at the location of a mouseover. I'd like the div to remained fixed at a location relative to the element that was hovered over (and automatically handle edge of browser cas...

defeating the enter key from doing a form submit

I've found several jQuery syntaxes for nullifying the enter on a form. First one: $("form input[@type=text]").bind("keypress", function(e) { var code=e.charCode || e.keyCode; return (code==13)?false:true; }); Second one: $("form").bind("keypress", function(e) { if (e.keyCode == 13) return false; }); My version: $('form').k...

How do make the text in the TEXTBOX to Capital letter when the user starts typing text in jquery

when the user starts typing the text in to the text box we need to make those letters to capital letters ...

AJAX Calls with Text Links

I want to make POST Ajax calls when users click on text links. One way to do it is to create many forms and make the submit button a text link. Then with jQuery I will fetch the variables from the form and submit them with Ajax. This will create something like the following: <form><input type="hidden" name="unique-id" value="1"><a hre...