jquery

What would be the jQuery equivalent of this Prototype Ajax invocation?

In Prototype, this Ajax call posts its form to the server as a URL encoded string of name-value pairs, as you would find in a HTTP GET request: function doajax() { var current_req = new Ajax.Request('/doajax', { asynchronous:true, evalScripts:true, parameters: $('ajax_form').serialize(true)} ); } How would you do the same thing ...

jquery: bind onclick

$(document).ready(function() { $('a#fav').bind('click', addFav(<?php echo $showUP["uID"]; ?>)); }); was before $(document).ready(function() { $('a#fav').bind('click', addFav); }); I added (<?php echo $showUP["uID"]; ?>) because i want the user profile´s id to work with in the addFav ajax call. So i have thi...

Can this Javascript be shortened with JQuery?

Hi folks, i'm checking out some newbie Google Maps API tutorial code. They have an example that says how to dynamically add some script to a page, once the page has finished loading. I'm wondering if this code can be made shorter if I use JQuery? here's the code... function initialize() { var myLatlng = new google.maps.LatLng(-34.3...

jQuery - Show all active bind()'s

Hi, is it possible to show all active jQuery bind()'s? Thanks in advance! Peter ...

jQuery DataTables Plugin Callback

Hi I need to cache the html of the table before applying DataTable plugin. I used to do it by caching the html and after it applying the plgin: var originalTableHtml = escape($('#DataTable').parent().html()); $('#DataTable').dataTable(DataTableOpts); However, now I need to do it somehow in another to do it. Is there any way to apply ...

How can I disable a button on a jQuery UI dialog?

How do I go about disabling a button on the jQuery UI dialog. I can't seem to find this in any of the documentation in the link above. I have 2 buttons on the modal confirmation ("Confirm" and "Cancel"). In certain cases, I want to disable the "Confirm" button. ...

How do you get the number of keys in a JSON object?

Hey everyone, I am creating a gallery plug-in in which I need to figure out the number of elements in a plain javascript object. The following is how I would like to be able to create the gallery. $.Gallery.create($('#galContainer'), { 'img1.png': 'http://linktosomewhere/', 'img2.png': 'http://linktosomewhere/', 'img3.png':...

jQuery: it addclass, remove class itself?

$(document).ready(function() { $('a#fav').bind('click', function() { addFav(<?php echo $showUP["uID"]; ?>); }); }); function addFav(id){ $.ajax({ url: "misc/favAdd.php", data: { id: id}, success: function(){ $('a#fav') .addClass('active') .attr('titl...

How to apply a $(document).ready function to asynchronously loaded elements?

I have the following function which applies watermark text to any text box on the page with the id "Search": jQuery(document).ready(function ($) { $("#Search").watermark({ watermarkClass: 'watermarkOn', defaultText: $("#Search").attr("watermarkText") }); }); The problem I'm having is that that this doesn't get...

Enable disabled keypress?

I'm trying to prevent double submission using the enter key on my form, but I can't seem to re-enable the keypress after the data has been submitted. Here's a part of my code: $(".adauga-clasa").submit(function() { var adaugaClasa = $('input[type=text]', this); adaugaClasa.keypress(function(event) { if (event.keyCode == '13') { ret...

jquery activate dropdown of select box

Hi, How can I activate/deactivate dropdown of classic selectbox by clicking to link in jQuery? I don't need selectbox replacing with jQuery, because it's too slow for huge number of options. I test everything but without result. Thanks sample page http://www.jklir.net/test-selectbox.html ...

jQuery: if class=active ?

$(document).ready(function() { $('a#fav').bind('click', function() { addFav(<?php echo $showUP["uID"]; ?>); }); }); I need to modify this so if the a#fav has class="active" then it should do removeFav(<?php echo $showUP["uID"]; ?>); instead How can i do this? ...

CakePHP: Embed CTP filename and path in views and elements

I'm looking for an elegant way to make a bit of jquery aware of the filename and path of the ctp file containing a given dom selection. I'm using simple_html_dom to write changes to template flies via an ajax call. I need to provide the filename and path of the view or element template ctp file that contains the dom element I've selected...

jquery: json data.error else

function addFav(id){ $.ajax({ url: "misc/favAdd.php", type: "POST", data: { mode: 'ajax', user: id}, dataType: 'json', success: function(data, status){ if(typeof(data.error) != 'undefined') { if(data.error != '') alert(data.error);...

How to display the HTML of an image

Say I have an image like this: <img src="someimage.png" alt="Image" /> I want to display the html of that image in for example a code tag, but how can I get it? I can get the image easily: $('img'); But how can I get the HTML of it and append it to a code tag? ...

How do I check if file exists in jQuery or Javascript?

How do I check if a file on my server exists in jQuery or Javascript? Thanks in advance. ...

including jquery menu and jqGrid on the page

I have a navigation menu which I need to include on all my pages....through jsp I just include the that menu <div id="header"><jsp:include page="../menu_v1.jsp"/></div> but problem is that my menu contains <html><head></head><body></body></html> Now when I want to use my jqGrid which is define on my new page inside <script></script>i...

Is it possible to create this chart using SVG Graphics and Javascript?

http://www.stockmapper.com/NDXtrac.html Would be possible to develop the above chart using SVG and Javascript or some other lightweight technology i.e HTML5.0 technologies? What sort of effort would be involved (man days)? Would the SVG version be as fast/smooth as it's flash counterpart? ...

jQuery and CouchDBX - _all_docs - HTTP 200 but no data is returned to success function

I can't access my CouchDB server (CouchDBX) using a jQuery AJAX call. I am able to access my demo database at localhost:5984/helloworld/_all_docs through browsers (tested with FireFox, Chrome and Safari). But when I do a simple AJAX call using jQuery I get no data returned. The requests completes with code 200. Here's what my AJAX cal...

How to activate a script after the button is press? [JQuery]

I need to activate cpa lead when the button is press. code: <script type="text/javascript" src="http://www.cpalead.com/mygateway.php?pub=52514&amp;amp;gateid=NjE1Njk%3D"&gt;&lt;/script&gt;. And the button is just <input type="button" /> So I need to activate the <script> after the button is clicked. Help please? ...