Re: [jQuery] JQuery Ajax serialize
Use parse_str(). But beware that that string has a problem: val */ $pairs = explode('&', $str); foreach($pairs as $pair) { $parts = explode('=', $pair); echo "key: ${parts[0]} -- val: ${parts[1]}\n"; } echo "\n---\n"; /* better way: parse the string into variables */ parse_str($str); echo "${single}\n"; // 'Single' echo "${multiple}\n"; // 'Multiple3' -- whoops! It takes the last value echo "${check}\n"; // 'check2' echo "${radio}\n"; // 'radio1' echo "\n---\n"; /* parse values into array instead */ parse_str($str, $arr); foreach($arr as $slice) { echo "${slice}\n"; // will get 'Array' for multiples } echo "\n---\n"; /* multiple element names should have '[]' */ $str = 'single=Single&multiple[]=Multiple&multiple[]=Multiple3&check=check2&radio=radio1'; parse_str($str, $arr); foreach($arr as $var) { if (is_array($var)) { foreach($var as $m) { echo "${m}\n"; } } else { echo "${var}\n"; } } On Sat, Jan 23, 2010 at 1:39 PM, parot wrote: > > I know this may be a silly question, but is there a "magic" way to insert > post data via serialization into a php/mysql database? > > e.g. a serilized array of > single=Single&multiple=Multiple&multiple=Multiple3&check=check2&radio=radio1 > > yes I used the Jquery serialize page info as an example. > > Is is best to use PHP to explode the array? or what? > > Or as asked is there a "magic" way to split the array into the fields & > values? > -- > View this message in context: > http://old.nabble.com/JQuery-Ajax-serialize-tp27288727s27240p27288727.html > Sent from the jQuery General Discussion mailing list archive at Nabble.com. > >
[jQuery] jQuery AJAX Question
I was curious if there was a way to hit the current xhr object in the success callback. I've been tinkering with it, and have been unable to figure out how to do that. The reason I ask is because I am trying to debug an application I've been working on, and sometimes the response XML is not formatted correctly; however, the occurrence seems random, and still triggers the "success" method, since there are no actual server-side errors. I'm looking to do something like: var data = $.param(myObj); // post data // AJAX to val page $.ajax({ "type": "POST", "url": "myval.asp", "data": data, "dataType": "xml", "async": true, "global": false, "cache": false, "success": function (objXml) { $(objXml).find("ticket").exists( // see if the ticket is present function () { var ticket = this.attr("number"); if (typeof(ticket) === "undefined") { errorProcess({ "fn": fnName, "detail": "Ticket is present, but value is null", "page": "myval.asp", "post": data, "responseText": xhr.responseText // need tp hit XHR object here }) } // do stuff } ).absent( function () { errorProcess({ "fn": fnName, "detail": "Ticket is not present in response", "page": "myval.asp", "post": data, "responseText": xhr.responseText // need to hit the XHR object here }); } ); }, "error": functon (xhr) { errorProcess({ "fn": fnName, "detail": "Specifics on what's supposed to happen", "page": "myval.asp", // page I'm trying to AJAX to "post": data, "responseText": xhr.responseText }); } }); $(selector).exists() and $(selector).absent() are functions I added. Basically, if the selector is found in the DOM, the callback in exists is executed, if it's not found in the DOM, the callback in absent is executed. I'm needing to hit the XHR object's responseText property inside the success function of the AJAX call, but am not able to do so. Any ideas?
[jQuery] jQuery/Ajax client storage
I apologize if this is already answered somewhere, as I could not find it... If the client is constantly calling ajax objects and those objects are bringing with them additional jQuery scripts, how does jQuery handle the removal and handling of objects that go away, because they are replace by a new object with a new script. Does one have to use a destroy/unbind to prevent memory/storage from growing? For example: 1) Client page loads 2) Page loads an edit (ObjA edit) via ajax, and the object is loaded with it's own set of validation and jquery functions. 3) ObjA edit is completed, so a new edit is loaded for ObjB (an entirely different object, not just a new instance of ObjA). Before load the div storing the edit is cleared. The newly loaded edit (ObjB edit) has it's own unique logic and validation. Will jQuery still contain the bound events and created functions for ObjA, eventhough the div was cleared? Thanks! Patrick
[jQuery] jQuery ajax: Simple web app: Need feedback...
Hi, I want to build a simple jquery-powered web application and I was hoping I could get some advice. The app: 1. User submits form data to server side script. 2. Server side script generates a CSS "page" and an HTML page. Note: the HTML will just be a bunch of divs. 3. jquery ajax loads the generated CSS/HTML into the head/body. 4. User has option to repeat steps 1 through 3 and add more HTML/CSS to the page. What would be the best way to link to the newly generated CSS page? Should I just append CSS links to the , or would it be best to just load each newly created style into a tag? In terms of the generated HTML, should I format it in any special way (JSON)? Would a simple load() be an acceptable approach to appending HTML to my app's body? Any tips/feedback would be great! TIA! Cheers, Micky
[jQuery] jQuery, $.ajax and reCAPTCHA
I'm trying to get jQuery to asynchronously load my recaptcha module, but it doesn't seem to like the fact that "echo recaptcha_get_html ($publickey);" spits out a mixture of HMTL and Javascript. Here's the code I am trying: $.ajax({ url: "inc/captcha.php", cache: false, success: function(html){ //$("#results").append(alert(html); $("#results").append(html); } }); // This does the same thing /*$.post("inc/test.php",function(returned_data){ $("#results").append(returned_data); });*/ It spits me out to a page with _just_ the recaptcha widget. I tested to see if it was my ajax call by making 'inc/captcha.php' merely say "Hello!" but it works. The offending reCAPTCHA code is possibly: http://api.recaptcha.net/challenge? k=6Lfz5AkAAKMcQLT5Q8_PrBHNZx4B8v34ABCC"> http://api.recaptcha.net/noscript? k=6Lfz5AkAAKMcQLT5Q8_PrBHNZx4B8v34ABCC" height="300" width="500" frameborder="0">
[jQuery] jQuery AJAX Request with non-form Data
Hi jquery users, I'm attempting to use jQuery to make an AJAX request. I'm able to successfully serialize form data from a POST submission and receive it on the server-side. However, I'd like to do something a little different. Rather than submitting form data, I'd like to submit the id from a div tag (e.g. ) to my server. For example, a user would click one of the divs below and the id for corresponding div should be sent in the ajax request: What would be the best way to do this? Should this be sent over as a key/value pair in JSON format? And, should I be using $.post to do this?
[jQuery] jQuery ajax post issue with IE7 and earlier versions of IE.
I'm using jQuery to do an ajax post on the key up event of a text input box (ajax search). As the user types a jQuery ajax post is made and a delimited string is returned (ex. "12345|Event Name#*#23456| Event Name") with all of the search results. Each result is then split into individual results by splitting the response of the ajax post by "#*#" and then further split into an id and name by splitting on "|". Javascript is then used to loop through all the results and generate a for each result returned like so Event NameEvent Name. jQuery then takes that list of div tags and appends it to a specified div. This works fine in both firefox and chrome but IE is having some issues with it. Specifically IE7 and earlier versions. IE8 works fine. In IE7 and older versions only the first div of the ajax response is rendered properly on the page. Here is an example of my code... $("#search_pane .aj2query") .keyup(function(){ var me = $(this); var aid = $("#aid").val(); var search = $(this).val(); var results = $(me).closest(".aj2").find(".aj2results") var o = $(me.results).empty().addClass("aj2load"); $.ajax({ type: "POST", dataType: me.dataType, url: ./events_roster_ajax.asp, cache: false, data: "cmd=events&q=demo, complete: function() { $(o).removeClass("aj2load"); me.lastSearch = q; }, success: function(msg){ arrMsg = msg.split("#*#"); $(results).empty(); $.each(msg,function(i,v){ if (v.split("|")[0] == "NULL"){ $("" + v.split("|")[1] + "").appendTo(results); } else{ $("" + v.split("|")[1] + "").appendTo(results); } }); //alert("Show em!"); //alert($(results).html()); $(results).find("div") .click(function(){ var crs_id = $(this).find(":hidden").val(); $(me).val($(this).text()); $("#cid").val(crs_id); $(results).empty().slideUp("fast"); getEventInfo(); }); }); }); }); The alert($(results).html()); line alerts all of the html that was generated by the ajax post however the results div only displays the first div generated by the ajax post. Another funny thing about this is that if I were to uncomment the alert("Show em!"); line of code all the divs render correctly.
[jQuery] Jquery, ajax and if-modified-since
Hi! I can't get the if-modified-since header to work with jquery ajax. I tried to fet an xml like this: $.get("url", function(xml){ //Do something with response. }, "xml"); On these requests the if-modified-since is not set. Then I tried like this: $.ajax({ type: "GET", url: "url", dataType: "xml", complete: function(XMLHttpRequest, textStatus){ }, ifModified: true, cache: true }); This cause the if-modified-since to be set to: Thu, 01 Jan 1970 00:00:00 GMT If I just load the url in the browser directly the headers are set correctly and the server can return a 304. These are the request headers: Hostlocalhost:8080 User-Agent Mozilla/5.0 (Windows; U; Windows NT 6.1; en-US; rv:1.9.1.5) Gecko/20091102 Firefox/3.5.5 Accept application/xml, text/xml, */* Accept-Language en-us,en;q=0.5 Accept-Encoding gzip,deflate Accept-Charset ISO-8859-1,utf-8;q=0.7,*;q=0.7 Keep-Alive 300 Connection keep-alive If-Modified-Since Thu, 01 Jan 1970 00:00:00 GMT X-Requested-WithXMLHttpRequest Referer http://localhost:8080/ Cookie __utma=1.1594413898.1260294412.1260294412.1260294412.1; __utmc=1; __utmz=1.1260294412.1.1.utmcsr=(direct)|utmccn=(direct)| utmcmd=(none); re_ret=0; re_ses=UQskC-7167631552; re_ses_indx=2; position=57.717%2C11.967%2C11 And here are the response headers: Server Development/1.0 DateTue, 08 Dec 2009 19:30:05 GMT Content-Typetext/xml Cache-Control public, max-age=3600 Last-Modified Tue, 08 Dec 2009 18:49:08 GMT Expires Tue, 08 Dec 2009 19:49:08 GMT Content-Length 148018 Why does not jquery ajax set the correct if-modifed-since header? //Magnus
[jQuery] jQuery Ajax BlockUI Database
While searching around I have seen plenty of examples where people query a database and use BlockUI to put up a wait message. When the ajax completes, unblock and display the results. I'm trying to do something a little different. I would like to query a database and use the results as the message of the BlockUI 'window' - a custom popup. (I tried using BeautyTip and it kinda works but I'm having trouble positioning the tip. Also, the tip only pops up on the second try because I'm actually assigning the ".bt" after the ajax completion. Any clues there?) OK, that's off-topic. Is this just a retarded way of doing this? Basically I have an old school area map with rollover info coming from a db.
[jQuery] jQuery AJAX call ie7 freeze
Hi, I have an HTML page which uses AJAX to load in information from Yahoo finance via CSV files and one AJAX call that calls a PHP file and performes some screen scraping. The problem: When these AJAX calls are performing their task it becomes impossible to click any links on the page. It freezes IE7 completly, the loading GIF images freeze and it akes ages for the link clicked to load. Works perfectly in FF and Safari. Any ideas??? The code: JavaScript: function fetch(){ var a = $.ajax({ type: "GET", async:true, url: "retreive.stock.php", dataType: "xml", success: parseXml }); function parseXml(xml){ for (i=0;i<=4;i++){ document.getElementById('index0'+i).innerHTML = xml.getElementsByTagName("index")[i].firstChild.nodeValue; document.getElementById('change0'+i).innerHTML = xml.getElementsByTagName("change")[i].firstChild.nodeValue; if(xml.getElementsByTagName("change")[i].firstChild.nodeValue.charAt (0) == "+"){document.getElementById('img0'+i).innerHTML="";} if(xml.getElementsByTagName("change")[i].firstChild.nodeValue.charAt (0) == "-"){document.getElementById('img0'+i).innerHTML="";} } $(".loader").hide(); $("#stockDiv").show(); } var b = $.ajax({ type: "GET", async:true, url: "retreive.currency.php", dataType: "xml", success: parseXmlCur }); function parseXmlCur(xmlCur){ for (x=0;x<=11;x++){ document.getElementById("c"+x).innerHTML = xmlCur.getElementsByTagName("value")[x].firstChild.nodeValue; } $(".loaderCur").hide(); $("#currencyDiv").show(); } var c = $.ajax({ type: "GET", async:true, url: "retreive.commodities.php", dataType: "xml", success: parseXmlCom }); function parseXmlCom(xmlCom){ //document.getElementById("val0").innerHTML = xmlCom.getElementsByTagName("value")[0].firstChild.nodeValue; //document.getElementById("cnge0").innerHTML = xmlCom.getElementsByTagName("change")[0].firstChild.nodeValue; for (x=0;x<=4;x++){ document.getElementById("val"+x).innerHTML = xmlCom.getElementsByTagName("value")[x].firstChild.nodeValue; document.getElementById("cnge"+x).innerHTML = xmlCom.getElementsByTagName("change")[x].firstChild.nodeValue; if(xmlCom.getElementsByTagName("change") [x].firstChild.nodeValue.charAt(0) == "+") {document.getElementById('imgCom0'+x).innerHTML="";} if(xmlCom.getElementsByTagName("change") [x].firstChild.nodeValue.charAt(0) == "-") {document.getElementById('imgCom0'+x).innerHTML="";} } $(".loaderCom").hide(); $("#commoditiesDiv").show(); } var d = null; d = $.ajax({ type: "GET", async:true, url: "retreive.libor.php", dataType: "xml", success: parseXmlLib }); function parseXmlLib(xmlLib){ for (x=0;x<=3;x++){ document.getElementById("lib"+x).innerHTML = xmlLib.getElementsByTagName("rate")[x].firstChild.nodeValue; } $(".loaderLib").hide(); $("#liborDiv").show(); } } Thanks very much! Tom
[jQuery] JQuery AJAX not working.
I have a page that uses a jquery $.get() method to retrieve content from a remote page. Ex $(function(){ $.get("http://domain.com/script.axd",{parameter1: "value1", parameter2: "value2"}, function(responseText){ alert(responseText); }); }); The above script returns a null or empty string even though the called page is returning "True" or "False" as string string. Thanks for help in advance.
[jQuery] jQuery Ajax Form from Queness - Text Input Field Disabled in IE6 IE7 ! Works in IE8, Safari, Firefox...
Can anyone look at this page and tell me what im doing wrong? I have the form working in all browsers except IE6, and IE7 html head (just in case of js conflicts): $(function() { $("#contact_collapse_button").click(function(event) { event.preventDefault(); $("#contact_collapse").slideToggle(); }); $("#contact_collapse a").click(function(event) { event.preventDefault(); $("#contact_collapse").slideUp(); }); }); JS (jquery.form.js): jQuery(function() { //if submit button is clicked $('#submit').click(function () { //Get the data from all the fields var name = $('input[name=name]'); var email = $('input[name=email]'); var phone = $('input[name=phone]'); var timeframe = $('input[name=timeframe]'); var emplcount = $('input[name=emplcount]'); var coname = $('input[name=coname]'); var coaddress = $('input[name=coaddress]'); var cocitystatezip = $('input[name=cocitystatezip]'); var comment = $('textarea[name=comment]'); //Simple validation to make sure user entered something //If error found, add hightlight class to the text field if (name.val()=='') { name.addClass('hightlight'); return false; } else name.removeClass('hightlight'); if (email.val()=='') { email.addClass('hightlight'); return false; } else email.removeClass('hightlight'); if (phone.val()=='') { phone.addClass('hightlight'); return false; } else phone.removeClass('hightlight'); //organize the data properly var data = 'name=' + name.val() + '&email=' + email.val() + '&phone=' + phone.val() + '&timeframe=' + timeframe.val() + '&emplcount=' + emplcount.val() + '&coname=' + coname.val() + '&coaddress=' + coaddress.val() + '&cocitystatezip=' + cocitystatezip.val() + '&comment=' + encodeURIComponent(comment.val()) ; //disabled all the text fields $('.text').attr('disabled','true'); //show the loading sign $('.loading').show(); //start the ajax $.ajax({ //this is the php file that processes the data and send mail url: "../js/process.php", //GET method is used type: "GET", //pass the data data: data, //Do not cache the page cache: false, //success success: function (html) { //if process.php returned 1/true (send mail success) if (html==1) { //hide the form $('#form-rfq').fadeOut('slow'); //show the success message $('.done').fadeIn('slow'); //if process.php returned 0/false (send mail failed) } else alert('Sorry, unexpected error. Please try again later.'); } }); //cancel the submit button default behaviours return false; }); }); HTML of form: Thank you ! We have received your message. You may refresh this page if you wish to refill the form again. Request MRX-35 Quote Your Name* Valid Email* Phone Number* Purchase Time Frame Company Name Company Address City, State, Zip # of Employees Additional Comments Let me know if you need css... Page in question: http://www.centraltimeclock.com/ctcbeta/timeandattendance/mrx35.php Thanks Everyone!!
[jQuery] jquery ajax and listening for users exiting the site
I want to send data to a remote site but only after the customer leaves. Its not working and I just want to make sure I am not doing anything wrong. can anyone see anything wrong with the collowing code $(window).bind('beforeunload', function() { $.post('http://myWebsite.com/usersessions/store', {data: this.exportJSON()}); }); -- View this message in context: http://old.nabble.com/jquery-ajax-and-listening-for-users-exiting-the-site-tp26155435s27240p26155435.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] jQuery Ajax Request Encoding
Hi I am trying to send Hindi अनुयायी characters to my PHP Script. I set request header as ascii, I want that it should store अनुयायी in database. When I am using form and submit it normally, it stores value अनुयायी in database properly for given word. But when I use jquery $.ajax method to post the data it doesn't store it in above format. When I display encoding of the text from $_REQUEST variable it shows UTF-8 when I submit through $.ajax but it shows ASCII when i submit it using normal submit. Can you please let me know how it can submit data using $.ajax as ASCII?
[jQuery] JQuery AJAX
Hey All, So I am having a weird situation when using the $.ajax method. And have a couple questions regarding this. What I am doing is basically just using this AJAX call to send a 'pixel' back to my server so I can collect stats on events. This event fires once every 30 seconds. $.ajax({ async: false, type: 'POST', url: myserver.com/index.gif?id=1&event=e cache: false, timeout: 0 }); My requests keep coming in as OPTIONS call, instead of POST. Every once in a while I will get a random rogue GET request that basically mimics the previous OPTIONS request. The OPTIONS come very 30 seconds. The rogue GET comes whenever, only seldomly. 1) What is OPTIONS and why would it come out as OPTIONS instead of POST? 2) Why would GET requests come at all? Why would they come randomly (seemingly) without being called? 3) Is this a proper way of sending a 'pixel' back to my server to track stats? If not, what is a better way? Very new to AJAX, and definitely don't know all the internals. Any help would be greatly appreciated. Thanks in advance
[jQuery] jquery ajax question?
Hi y'all, Please look at this code: $('ul#navigation li ul li>a').click(function(){ var active = $(this).text(); $('#artcontent p').empty(); $.ajax({ type: 'POST', url: 'homepage/readarticle', data: $(active).serialize(), success: function(databack){ $('#artcontent').append(databack); } }) }); I have a ul li a that are children of parent ul navigation and li. what I am trying to do is to load an article page. This works but it reads the database and loads all the articles in my database instead of the one identified by active. I would like to know what I am doing wrong or is there a better way to go about this?
[jQuery] jQuery AJAX call undefined error with special characters
Hi, I tried to make an AJAX call using jQuery, the data has special characters, e.g "{'data':'test'}". It seems failed to pass this data in the first place. It will work if i just pass "{'data':'test'}". encodeURIComponent and JSON.stringify failed here due to the special character "< > /". Could anyone please help with it? Thanks. $.ajax({ type: "POST", url: "services.aspx", data: "data=" + encodeURIComponent(JSON.stringify(obj)), dataType: "text", error: function(xhr, textStatus, errorThrown) { alert("ERROR"); }, success: function(data) { } }); Regards, David
[jQuery] Jquery ajax form
I'm using the jquery form plugin from here: http://malsup.com/jquery/form/ Is there any callback function or handling of server-side errors in this plugin so I can now if an ajax action failed? Thanks, Craig
[jQuery] jquery ajax not working in mozilla
hi, i use jquery and calling my service function by using jQuery ajax. it works fine in IE and return data in json format but when i run this in firefox this method is not call means ajax method call is not called in firefox. where is problem in code here is my code my service is host on remote server. function InsertList() { var list = new Array(); list.push({ Name: 'John', Designation: 'Associate Consultant' }, { Name: 'David', Designation: 'Senior Consultant' }); var json = Sys.Serialization.JavaScriptSerializer.serialize(list); $.ajax({ url: 'http://localhost:3162/VirtualService/RestService.svc/ InsertList', type: 'PUT', contentType: 'application/json;charset=utf-8', data: json, success: function(response) { $('#divResult').html(response.text); } }); }
[jQuery] jQuery AJAX pulling styles
I'm using the $.ajax() function to grab a page and parse it ... but when I do, any styles on the page I pulled are applied to my page. Obviously this isn't what I want, I just want the data to parse. How can I avoid this?
[jQuery] jQuery + Ajax request
Hello! Im trying to build a AJAX request with jQuery, the function should work like this. I have a list of words like this. [code] kuken x test x [/code] and a Javascript like this [code] $("#removeSearchword").click(function(){ var sokord_id = $("#sokord_id").val(); var register_id = $("#register_id").val(); var sokordet = $("#sokordet").val(); $.post("index.php/adminpanel/ testformremove", { sokord_id: sokord_id, register_id: register_id }, function(data){ $("#searchword_"+ sokordet).slideUp ("normal", function() { $("#searchword_"+ sokordet).before(''); }); } ); return false; }); [/code] The problem im having, is that i can only press the "x" (remove) link on the first one, not on the next one. Nothing happens when i press the secound "x". Why is that?
[jQuery] Jquery Ajax Postbacks
can ant one tell me or give me some shot example regarging jquery ajax post backs or related some documents it will great help for me Thanks in Advance gladrinkz
[jQuery] Jquery Ajax load function
Hi all I want to load some url without refreshing the page in my project. I am using jquery for it. It is working but just once. When I cliked it twice its not working. code is like that function test(){ $("#main").load("compare.do"); } Test in jquery ajax examplehttp://docs.jquery.com/Ajax/load#urldatacallback there is some note; Note: Keep in mind that Internet Explorer caches the loaded file, so you should pass some extra random GET parameter to prevent caching if you plan to call this function more than once how can I prevent caching? mabe it solves my problem.. Thanks
[jQuery] jQuery - Ajax and Load question
Hello, I have a function that have this: $.ajax({ type: 'GET', url: 'index.php', data: 'id=' + productId + '&qtd=' + quantidade }); This piece of code is working great, but i need to know how to get the response from the specified url, for example, the response from index.php is two, i need to get that to place it inside a div, i know with load i can do that, but i want to be able to send in the response an array with some data. Hope you understand :[ Regards!
[jQuery] jquery ajax
Hi, Is it possible to call a http url for ajax query i.e. $(document).ready(function(){ $.ajax({ type: "GET", url: "http://www.domain.com/mypage.php";, data: "site_id=" + site_id, success: function(tags){ $("" + tags + "").appendTo("body"); } }); }); Seems like url: "http://www.domain.com/mypage.php";, is not allowed coz it doesnt echo/display any coming from http://www.domain.com/mypage.php Thanks in advance, Mike
[jQuery] Jquery Ajax Post question
$.post("test.php", { func: "getNameAndTime" }, function(data){ process(data); }); Is one of the examples given for Jquery. Now I am trying to implement Jquery Ajax instead of a custom class we have here so am trying to catch on so bear with me. Above, it shows POST variable "func" containing "getNameAndTime" as a value correct? So if I wanted to pass along say names I would pass along {first: "Bob", last: "Smith"}? I find adding the callback function right in the call a little awkward (probably because I'm new to Jquery). Basically I was adding a onClick function to a link to a function (function test()) and inside I was going to add this jquery code. I just wanted to then have the returned data at my disposal in a variable but it looks like I need to pass it somewhere else? I basically wanted to do this: function disableTips () { $.post("./test.php", {id : id_val}, function(data){ something here? } }) ; then do something with data here } Am I going about it completely the wrong way with jquery?
[jQuery] jQuery, ajax, json, php
If I send a json format to php, how to get the value from php? for example front page var jsonStr = '{"name": "David", "age", "23"}'; $.ajax({ url: 'json.php', type: 'POST', cache: false, data: {json: jsonStr}, success: function(data) { alert(data); } }); php page
[jQuery] jQuery ajax - can i know if the server is alive ?
Hi there friends i was wondering if i could acheive this make an ajax request using jquery and know if the server is alive even before the request is sent. For example, i have a div, that changes to "Connecting to server"..."Connected to server, sending request""Request complete" - showing the different stages of the request. So if the server is not responding, i would like it to be something like "Connecting to server"..."Cannot connect to server".."Request failed". Is there any way i could achieve this? Thanks Vru
[jQuery] jquery, ajax and flot
Hi, I'm kinda a newbie to jquery and am stuck with a project I'm trying. I am using the flot graphing library to plot a couple of graphs. But I want to be able to load different data sets into my graphing canvas by using ajax. Here is what I have so far: $(function(){ $("a.hotels").click(function() { //the main ajax request $.ajax({ type: "POST", data: "action=hotel", url: "votes.php", success: function(result) { $.plot($("#graph"), [ result ]); } }); }); }); The response I get from the votes.php file looks like this [1.2438141E+12,60],[1.2437277E+12,53],[1.2436413E+12,60],[1.2435549E +12,59],[1.2434685E+12,55],[1.2433821E +12,59],[1.2432957E+12,60], which is plottable by flot. My only problem is, how do I insert that response inplace of 'result' in the success funtion. Currently it only comes out as 'result' if I view the source of my page, but if I add $("span#output"+the_id).html(msg); to the success function, then I do see my output correctly. Any help would be greatly appreciated, thanks.
[jQuery] jQuery ajax 404 error
Hi, all. I have extremely annoying issue for my project, which made me keeping 3 days on it. I used jQuery.ajax, but it gets all time 404 error, although target url is still available. When I have checked with firebug console, yes, it shows target url with red color, which might mean that no file on this url. But when I expand this request, I can see the response which I wanna get. I really do not understand what s going on there. Any tips on this situation? dataType is set as text and what I wanna get is letter like "P", "T", etc. Thank you.
[jQuery] jQuery Ajax grid
Hello, We are starting a new ASP.NET MVC application and want to use an jQuery Ajax grid. I came across following options: - jqGrid (better than Flexigrid because it supports editable cells) - Flexigrid (looks better than jqGrid) - tablesorter - Ingrid - jqGridView - OTHERS? Which is the best choice for jQuery Ajax grid ? Which is the most popular jQuery grid/table ? Thank You.
[jQuery] jQuery Ajax breaking in IE..... please help!!
I am developing a VoIP Customer Portal with jQuery/Ajax. Everything works fine in Firefox, but in IE and Safari, the JS breaks. I used MS Script Debugger to get a backtrace, and i find that the breakpoint is at a jQuery Ajax call: var AJAXURL = 'app/ajax.php'; $.ajax({ url:AJAXURL+"auth-login", type:"POST", data:"user="+uname+"&pass="+pass, dataType:"json", success:function( json ) { // code removed } }); Why oh why is this happening?? Any help would be greatly appeciated.
[jQuery] [jQuery AJAX]
I am using the jquery.form.js addon, and I was wondering if there was a way that I could add something to check for a certain string in resulting response? I am having a form sending an AJAX request to the server which then places the result into the div that is used for responses but I am unsure how to initialize a check when the div updates that word is used in the div for example "experience"... when that comes up I would like to disable a feature to keep the form from submitting again... Any ideas how I would check the string? Maybe when I submit probably? Thanks for your help ahead of time...
[jQuery] jQuery Ajax SUCCESS: using 'THIS'?
Hello, I have the following jquery ajax request: Approve /*Approving..."); jQuery.ajax({ 'type':'POST', 'data':'id=205', 'dataType':'text', 'success':function(msg){ alert($(this).attr("id")); }, 'url':'/approve/article', 'cache':false }); return false; }); }); /*]]>*/ First replaceWith working fine, link changes to 'Approving', but alert saying 'undefined' instead of 'yt1'... Any ideas acessing this link in a script where I don't know exactly what id does this link have? I know that alert($("#yt1").attr("id")); would work, but 'yt1' is auto- generated by my framework, so I need to access it without $("#_id_") but using 'this' or any other appropriate method. Thanks in advance. Roman
[jQuery] jQuery Ajax Error in Firefox 3.0.8
Hi friends I tried to develop an ajax request using jQuery It works fine with IE and Even Chrome But I always getting same error in firefox "411 Length Required" On firebug error shows on jquery.js line no 19 my code is given below $.ajax({ type:'POST', url:'ajax.php', dataType:"html", cache:false, timeout:1, beforeSend:function(){ $('#searchresult').html(" "); }, error:function(){ $('#searchresult').text("Server Not Responding ,Try again ").show ().fadeOut(2000); }, success:function(data){ $('#searchresult').html(data); } }); Is there any common error with jquery + firefox + ajax I tried versions of jquery 1.2.6 and 1.3.2 expecting your help Geo ..
[jQuery] jQuery $.ajax and dataType
Hi, When using the $.ajax functionality i came across some things. You have to set the dataType option in order to get the correct data at success(). Now I have an ajax request that can return some html or json. Both use the correct content-type header. Now I see in the httpData function of jQuery that it will get xml and in other occasions it will use the set dataType. Why not a check on content-type? In the httpData is a part like: // The filter can actually parse the response if( typeof data === "string" ){ // If the type is "script", eval it in global context if ( type == "script" ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == "json" ) data = window["eval"]("(" + data + ")"); } Maybe it is possible to change it to: // The filter can actually parse the response if( typeof data === "string" ){ // If the type is "script", eval it in global context if ( type == "script" || ( !type && ct.indexOf("javascript") >= 0 ) ) jQuery.globalEval( data ); // Get the JavaScript object, if JSON is used. if ( type == "json" || ( !type && ct.indexOf("json") >= 0 ) ) data = window["eval"]("(" + data + ")"); } (please check the httpData in jquery.1.3.2.js!) In this way, when dataType is omitted, it'll take a look at the returned content type. Offcourse, this is just a quick rewrite and maybe not even correct but with some simple tests it worked well. Snef
[jQuery] jquery, ajax success but wont load htl() ???
i had this working at one point but was still cleaning up the php. and now it wont load my entries at all using html() i see the response from success in firebug console and if i use text() it loads the html code in the div i assign but when using html() to render results it does not load anything. anyone have any idea whats going on? Anyone have any suggestions on why this wont load the html i get in my success response(r) here is what i am using: jQuery("#submit").click(function() { var inputs = []; var name = jQuery("#search").attr('value'); var searchdistance = jQuery("#searchdistance").attr ('value'); var searchlocation = jQuery("#searchlocation").attr('value'); var artist = jQuery ("#cb_registerasA").attr('value'); var dj = jQuery("#cb_registerasD").attr('value'); var engineer = jQuery("#cb_registerasEn").attr ('value'); var executive = jQuery("#cb_registerasEx").attr ('value'); var model = jQuery("#cb_registerasM").attr('value'); var producer = jQuery("#cb_registerasProd").attr ('value'); var promoter = jQuery("#cb_registerasProm").attr ('value'); var photo = jQuery("#cb_registerasPhot").attr ('value'); if(jQuery("#search").attr('value') != "") { inputs.push('search' + '=' + name); } if(jQuery("#searchlocation").attr('value') != "") { inputs.push('searchdistance' + '=' + searchdistance); } if(jQuery("#searchlocation").attr ('value') != "") { inputs.push('searchlocation' + '=' + searchlocation); } if( jQuery('#cb_registerasA').attr('checked')) { inputs.push ('cb_registerasA' + '=' + artist); } if( jQuery('#cb_registerasD').attr('checked')) { inputs.push ('cb_registerasD' + '=' + dj); } if( jQuery('#cb_registerasEn').attr('checked')) { inputs.push ('cb_registerasEn' + '=' + engineer); } if( jQuery('#cb_registerasEx').attr('checked')) { inputs.push ('cb_registerasEx' + '=' + executive); } if( jQuery('#cb_registerasM').attr('checked')) { inputs.push ('cb_registerasM' + '=' + model); } if( jQuery('#cb_registerasProd').attr('checked')) { inputs.push ('cb_registerasProd' + '=' + producer); } if( jQuery('#cb_registerasProm').attr('checked')) { inputs.push ('cb_registerasProm' + '=' + promoter); } if( jQuery('#cb_registerasPhot').attr('checked')) { inputs.push ('cb_registerasPhot' + '=' + photo); } jQuery.ajax({ data: inputs.join('&'), url: 'index.php? option=com_usersearch&act=searchusers&format=raw', timeout:5000, error: function() { console.log("Failed to submit"); }, success: function(r) { //alert(r); jQuery("#searchresults").slideUp(); jQuery("#searchresults").html(r); jQuery("#searchresults").slideDown(); } }) return false; });
[jQuery] jQuery AJAX Forms Question
I'm using the jQuery Validation and jQuery Forms plugins on my Submit Form. I have the validation portion working correctly and the AJAX submit working correctly. However, I would like a few things to happen after the user has submitted information. I would possibly like to show a simple loading overlay (in a shadowbox) so that the user knows the form is working and I would like to redirect the user to another page after the process is complete So far this is what I have: $("#submitForm").validate({ submitHandler: function(form) { jQuery(form).ajaxSubmit(); } }); And in my form I have the Action directed to the PHP file that uploads the user information. Where would I put events that occur after the submit button is pressed? I tried to place something in my submitHandler function but then the upload ceased to work properly. Thanks, Tim
[jQuery] Jquery ajax doesn't work in firefox on my site, once it used to be.
Hello everyone, Recently I have just created a site using CodeIgniter with JQuery. And in the past, it worked just fine. But recently I don't know why I got error message in FireFox(3.0.6) through firebug and there is no result displayed in my site. However, it works just fine in IE and other browsers. Are there any suggestions or solutions? The site is http://guessword.dictionary2gether.com/ Sorry, this is the duplicate post, cos I couldn't find the solution yet. Hope someone can help. Thanks, Makara -- View this message in context: http://www.nabble.com/Jquery-ajax-doesn%27t-work-in-firefox-on-my-site%2C-once-it-used-to-be.-tp22384573s27240p22384573.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] jquery ajax tabs with normal forms
Hi, I am using jquery ajax tabs. In one of the tab, i am using a form ( i didn't use jquery form). while submitting the form, it is going a fresh page. But i want to retain the tabs. Any suggestions? Regards, Iswaria
[jQuery] JQuery Ajax XML
I have tried searching solution to my problem with JQuery AJAX with XML document. I am trying to access XML document from the Library of Congress. The URL is: http://z3950.loc.gov:7090/voyager?version=1.1&operation=searchRetrieve&startRecord=1&maximumRecords=1&recordSchema=marcxml&query=9780020419808"; I typed the url in the browser address on Safari and Firefox. The XML document was received as expected. Through JQuery AJAX the XML document was never received. I wonder whether Library of Congress could tell difference between AJAX and browser requests. What's wrong with my code? Request Library Catalog $(function(){ $('#update-target a').click(function(){ $.ajax({ type:"GET", url:"http://z3950.loc.gov:7090/voyager? version=1.1&operation=searchRetrieve&startRecord=1&maximumRecords=1&recordSchema=marcxml&query=9780020419808", dataType:"xml", success:function(xml){ alert("XML arrived."); $("version",xml).each(function(){ var id_text=$(this).text(); $('') .html('version ('+id_text+')') .appendTo('#update-target ol'); }); //close each( } }); //close $.ajax( }); //close click( }); //close $( Click here to load library catalog Thanks for your great help in advance!
[jQuery] jQuery AJAX File Upload
I know, not possible to do without hidden iframe hacks and such and there already exists a couple of extensions which add this functionality by abstracting these hacks out of our sight... however, I ran across this article here: http://igstan.blogspot.com/2009/01/pure-javascript-file-upload.html Which talks about doing it in pure AJAX only in FF3, he gives source code to do this, however I was wondering if this sort of functionality was already possible or could be mimicked using the jQuery.ajax object. The reason I ask is because I'm interested in developing a Ubiquity (http://labs.mozilla.com/2008/08/introducing-ubiquity/) command which would upload a local file to a web service... and Ubiquity is only for FF and includes the jQuery library in their namespace. If this isn't currently possible, is anyone interested in helping me to extend jQuery with this functionality and submit for inclusion in a future version? I'm pretty new to the contributing to open source community and don't know the best practices for getting and submitting new source code to an open project. Thanks a lot. - Gooseus
[jQuery] Jquery Ajax one request, multiple answers problem
Hello, I've been working on a jquery projet (with the lastest stable version of jquery) that retrieves information using json from a php script that requests information from an API. The script lists all the different extensions with a status colomn that says what it's doing (waiting, searching or result). The script gets the list of extensions form an input select drop down that's generated by PHP (this allows me to manage extensions using a database). It then launches the search for the selected extension and when the search is finished it launches the search for all the other extensions. I need one answer per query but it seems that the ajax success function is launched more than once which is not what I want, also sometimes it seems to keep some sort of memory of what the answer was last time (if I add a sleep function to the php script sometimes it gets the first answer befor the sleep is over) ... I've got a php script to check whois servers that replys with either taken, available or error. When the whois servers answer quickly there are no visible problems, but when they are slow the ajax request seems to be launched a second time and sometimes a third time when they are very slow. So I might see for example : domain.com, status : available, and then 2 seconds later it will be replaced by domain.com, status : error and sometimes then replaced by domain.com, status : available. In order to test this I replaced ".html(" by ".append(" and I can then see all the different results... Of course I could check that the html id contains the "searching" text and if not to not change it's value, but I would like to stop it launching the search more than once ... ! Is this a bug or an error in my code ? should I try it with an earlier version of jquery ? Here is my javascript code : function CheckWhois() { $('#domchk').submit(function() { ls = Array(); $("#dext>option").each(function(i){ i = i+1; ls[i] = $(this).val(); }); var ndom = $('#ndom').val(); var dext = $('#dext').val(); $("#domresult").html("id=\"domtab\">Sel.Domainstatuscolspan=\"4\">Chose TLDtype=\"checkbox\" name=\"sel\" value=\""+ndom+dext+"\" />"+ndom+dext+"src=\"images/domload.gif\" alt=\"en cours ...\" />colspan=\"4\">Autres Extensions"); for ( var e in ls) { if (dext != ls[e]) { $("#domtab").append("type=\"checkbox\" name=\"sel\" value=\""+ndom+ls[e]+"\" />"+ndom+ls[e]+"src=\"images/domball.gif\" alt=\"waiting ...\" />"); } } $.ajax({ url : "scripts/ajaxwhois.php", type : "POST", data : "domain="+ndom+"&ext="+dext, dataType : "json", error : function (xhr, desc, exception) {$("#chosenstatus").html("Error"); }, success : function (data) { if(data.error) { extd.html("Erreur"); } else { $("#chosenstatus").html(data.status); for ( var e in ls) { var extd = $("#status"+e); if (dext != ls[e]) { extd.html("src=\"images/domload.gif\" alt=\"searching ...\" />"); GetWhois(ndom,ls[e],e); } } } } }); return false; }); } function GetWhois(ndom,ls,e){ $.ajax({ url : "scripts/ajaxwhois.php", type : "POST", data : "domain="+ndom+"&ext="+ls+"&num="+e, dataType : "json", error : function (xhr, desc, exception) { $("#status"+e).html("Error");}, success : function (data) { if(data.error) { $("#status"+e).html("Error"); } else { $("#status"+data.num).append(data.status); } } }); } $(document).ready(function(){ CheckWhois(); }); Thankyou !
[jQuery] jQuery Ajax XML not working in IE6(most people)
Hello, I have been looking at this for a few days now and I am not having any luck. I am using jQuery 3.1.1. I don't think I have any character encoding issues, all files are in UTF-8 format. Is it possible that I left a header out when creating the XML file - like the doctype=text/xml? If so how do I make sure this is added? Well thanks for taking a look. :D MY HTML + JS --- New Products New Products Feed Hello World Target Output DIV --- MY XML --- 1N4148WS Small Signal Diode Small Signal Diode /pf/1N/1N4148WS.html /ds/1N/1N4148WS.pdf /ShoppingExperience/action/displayItems? gpn=1N4148WS&itemType=BUY /ShoppingExperience/action/displayItems? gpn=1N4148WS&itemType=SAMPLE 1N4148WS SOD-323F S Y 04/14/2008 2 1N4148WT Small Signal Diode Small Signal Diode /pf/1N/1N4148WT.html /ds/1N/1N4148WT.pdf /ShoppingExperience/action/displayItems? gpn=1N4148WT&itemType=BUY /ShoppingExperience/action/displayItems? gpn=1N4148WT&itemType=SAMPLE 1N4148WT SOD523F S Y 03/06/2008 1N4448WS Small Signal Diode Small Signal Diode /pf/1N/1N4448WS.html /ds/1N/1N4448WS.pdf /ShoppingExperience/action/displayItems? gpn=1N4448WS&itemType=BUY /ShoppingExperience/action/displayItems? gpn=1N4448WS&itemType=SAMPLE 1N4448WS SOD-323F S Y 04/14/2008 2 ---
[jQuery] jquery / ajax
Hi, i got a radio button. if this radio button is checked it shell send the value of the button to a .php document. didn't used ajax at all so i don't know how to do this. at the moment i tried something like this: $(":radio").click(function() { $("#infoding").css("display","block"); var value = $(this).val(); $.ajax({ type: "POST", url: "some.php", data: value, success: function(msg){ alert( "Data Saved: " + value ); } }); }); got it out of some documentation but don't know if it would work 'cause i'm not able to test it at the moment. i'd like to know if this would work and if not how it could work. i'd be happy about any help. thanks -weidc
[jQuery] jquery, ajax, and search engines
I've noticed when I fill in dynamic content on a page using jquery that when you view source you don't see the dynamic content. So I'm wondering if search engines don't see it as well. It's obviously a serious consideration. Thanks!
[jQuery] jQuery Ajax, getting data returned from my PHP script
Hi All, I created a form and decided to add some AJAX. What I want to do is add a * next to my required label elements and change to * when the AJAX blur event validates each of my fields. My problem, when I run the script I get no data returned from my ajax- validation.php script. Can anyone help?? many thanks gemmes // SELECTED JAVASCRIPT /* AJAX Form */ $('#submit').click(function() { // using click instead of blur while in development var name = $('input#name').val(); var email = $('input#email').val(); var message = $('textarea#message').val(); $.ajax({ type: 'POST', url: 'ajax-validation.php', data: 'name=' + name + '&email=' + email + '&message=' + message, success: function(results) { alert( "Data Saved: " + results ); // This alert has given me no feedback - always blank } }); // end ajax return false; }); // End .click() // SELECTED PHP
[jQuery] JQuery ajax loaded pages lose scripts
When using the JQuery ajax to inject a page into another page, I lose the script file access from that page. I've tried reloading the script using $.getScript but with the JQuery UI I get a stack overflow on line 509. Here is the code I use for getting the external file: $.ajax({url: 'myfile.htm',cache: false,success: function(html) {fncLoadContent(html);}}); Anyone have a way of making the scripts available to files loaded through ajax? thanks ^.^
[jQuery] jQuery ajax Samples
Hi All, I was wondering whether I could find any good basic examples for $.ajax where I could find how to use the options of the $.ajax. I wanted to see how we can use the dataType: 'xml' / 'json' / 'html' etc options to capture respective data and use them. docs.jquery.com provides very basic syntax without the server side code.
[jQuery] jquery ajax-built page with embedded ajax code issue
i've got a page where the body is dynamically generated/regenerated using ajax with clickable links, using the following snippet to replace the maintext div w/ the output from the ajax.php script: $('.ajax_link').click(function() { clicked_link_id = $(this).attr("id"); $.ajax({ dataType: "text", type: "POST", url: "ajax.php", data: "a=" + clicked_link_id, success: function(msg) { $("#maintext").fadeOut("slow", function() { document.getElementById('maintext').innerHTML = msg; $("#maintext").fadeIn("slow"); }); }, error: function(XMLHttpRequest, textStatus, errorThrown) { alert("Error:"); } }); return false; }); sometimes the page info returned from ajax.php (and thus displayed in the maintext div) itself contains an ajax clickable link. when this link is clicked, however, instead of being correctly 'intercepted' by the ajax snippet above, instead attempting to actually load the link specified in the href parameter in the browser (which i've set to #, since i want jquery to handle the link). any help would be appreciated. thanks, -ray
[jQuery] JQuery Ajax get function BROKE in Safari 3.2.1 (latest)?!
Ok, I'm using the simplest possible jquery ajax get call to execute a database call in another php file (since I switched from using a really nice prototype powered function thinking it was prototype's fault for not working in Safari), but I can't get it working in the latest version of Safari no matter what (as much as I couldn't get prototype one to work in Safari either). This works just fine in IE6, IE7 & FF3, but Safari is not budging - it's not executing for some reason... here's the code: http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd";> http://www.w3.org/1999/xhtml";> Test function setVideo(video) { $.get("setVideo.php", { video: video } ); } http://download.com/video_1.zip"; onclick="setVideo ('video_1');">Click to view Video #1 Using the latest jQuery and/or Prototype, and still can't figure out why this simple call doesn't work in Safari... anyone? It's eating me alive, consuming hours of my time trying to google up some solutions, and no luck...
[jQuery] jQuery Ajax load problem
Hi, I am using jQuery 1.2.6, and also have Prototype 1.6.0.1 and Scriptaculous 1.8.1 in my page. I have pretty much everything working without receiving any javascript errors, but for some reason the ajax load script is not working: jQuery(".tablesorter > tbody", "#tab").load(path, data, function(responseText, textStatus, XMLHttpRequest){ // do stuff here }); This should load html into the tbody tag, but instead it is wiping out everything in the .tablesorter table, including the thead and the tbody tags. I had it working with just jQuery, but with the inclusion of Prototype and Scriptaculous it doesn't seem to work right. Wondering if anyone has experienced this problem? Thanks Thanks -- View this message in context: http://www.nabble.com/jQuery-Ajax-load-problem-tp20486998s27240p20486998.html Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] Jquery Ajax load()
Hi, I am using the command, $("#divId").load('url'); my development is in J2EE(JSP). The problem is the content loaded by this command is not accessible to other jquery scripts. like if i have cascading dropdowns. the user selects first dropdown, based on its value the other dropdown gets loaded. the newly loaded dropdown cannot be selected by using any selector expressions. i cannot use the $("#newdropdown").change(). What is the problem. is it that the DOM is not being updated? Will other jquery commands like $.ajax() solve the problem? (Code for refrence below) Regards Abhinav HTML: Apparel Shoes Script: $(function(){ $(select#dropdown1).change(function(){ $("div#dropdown2div").load('dropdown1.html'); }); }); $(function(){// This is not working $(select#dropdown2).change(function(){ $("div#dropdown3div").load('dropdown2.html'); }); });
[jQuery] jQuery Ajax Data url encoding
Hello, Im doing a simple ajax request: $.ajax({ type: 'POST', data: 'action=link&link=' + v, url: getLocation('?switch=link'), dataType: 'json', success: function(json) { showMessage(json.msg, json.status); } }); "v" in data is url like "http://localhost/pub/file? a=&g=1746&p=00&s=13"; Server receive POST: array ( 'action' => 'link', 'link' => 'http://localhost/pub/file?a=', 'g' => '1746', 'p' => '00', 's' => '13', ) escape(v), encodeURI(v), encodeURIComponent(v) doesn't help. Thanks for any advice.
[jQuery] Jquery Ajax vs base Ajax approach
Hi, Jquery is gr8 I agreed. But when I am working on a registration page then this jquery is not providing me seamless effect. There is two select box - drop down 1 State 2 City when ever a user select a state correspondingly city comes in city drop down. I used two apprach for this 1 Ajax- Jquery $.ajax({ type: "POST", url: "url('/users/city') ?>", data: "state_id=" + escape(state_value), success: function(html){ $("#id_city").html(html); } 2 Base Ajax approach Create a HTTP object : httpObject Open http connection httpObject.open("GET", url, true); httpObject.send(null); httpObject.onreadystatechange = setOutput; getting response on httpObject.readyState == 4 Base Ajax approach return me better results then jquery. But I need seemless - more better results... Can somebody tell me how should I get more better results for this? Should I follow jquery instead of Base AJAX approach? Thanks
[jQuery] Jquery/Ajax expert
A Jquery/Ajax expert required for a mobile phones company. The work is to cover intranet in UK and India for the call centre team. Your input will primarily be on Jquery. Your experience will cover sliders, collapsible lists, drag/drop, ajax requests to D.B etc Its expected you have correspondingly strong markup/css experience. You will be queried on specific areas and given specific tasks. Require feedback on how things would work using the backend specified below. This position does not need your full time input. Hours flexible, working remotely, turnaround to be in a reasonable time frame after a job has been alloted to you. Platform: .Net, M.S. Sql. Target browser: IE6. Designs: Photoshop psds. Thankyou.
[jQuery] Jquery Ajax usage question
Currently, I use jquery's ajax function to create dymanic pages. But I don;t think I understand to to correctly make jquery event listners respond to the the DOM elements that I added via ajax response. I'll give an abrevated example below The function of the below script is to pop an alert box with the id of the that was clicked form the list $(document).ready(function(){ $('.a').click(function(){ alert(this.id); }); $('#bAdd').click(function(){ $.ajax({ . Abrevated .}) }); }); Original HTML Add one more Link to click Click here (1) Click here (2) Click here (3) When the link withe id bAdd is clicked it gets and additioanl line form the server and inserts it at the bottom of the list NEW DOM HTML Click here (1) Click here (2) Click here (3) Click here (4) The issue is that the jquery select "$('.a').click()" does to see the newly inserted line # 4... So clicked it will not yeild the desired function, pop an alert pop. I've been getting around this but including id specific event handling code in the injected ajax dom element. But that mean I have to maintain to diffrent Jquery functions; on the main page and in side the ajax responce function. this there a way where I can my use of jquery class selections, inject dom element via ajax and still maitn just one set of JS jquery functions. Thanks
[jQuery] Jquery AJAX data (querystring restriction)
Hi Guys, I have been using JQuery for quite some time now but I am now stuck with a problem. I have a form with multiple fields and in one of the field (comments) user can use it to provide huge comments (say more than 2500 characters). I dont know how to send this through JQuery since IE has a 2083 character restriction. Any suggestions are highly appreciated. Thanks, Raja
[jQuery] jquery ajax post not working
I am trying to use ajax post to simply send a form field to php and return it to a div Here is what I have $(document).ready(function(){ $("#addLinks").submit(function() { $.ajax({ url: 'addLinks.php', type: 'POST', data: {url: $("#url").val(),title: $ ("#title").val() }, error: function(){ alert('Error adding link'); }, success: function(data){ $("#contentcol4").append(data); } }) }); }); the php file contains i keep getting a error of This XML file does not appear to have any style information associated with it. The document tree is shown below. im not sure what to do, I am new to this Thanks
[jQuery] Jquery Ajax does not support HTTP Streaming ?
Hi everyone, I want a solution to keep a connection open with my client so he can get almost a live update and also we don't want Ajax to connect every few minutes (we are building almost real-time web game) I came a cross this nice article http://ajaxpatterns.org/HTTP_Streaming which tell you some solution to do this. I did it in my script and it's working fine if I access the script directly (from browser) but when I try to do it with JQuery Ajax, it will wait until the script close the connection then i will do the action. to explain more, here is my 2 scripts: == index.html:
[jQuery] jQuery Ajax content
Hi, iam loading with the jQuery Tab UI in touch with the ajax function, remote dynamic content. After jQuery has load the content, i would like to use jQuery over again in my template. But , i cant use jQuery again in ajax loaded content ... ! Is there a way to solve this problem? vince
[jQuery] jQuery AJAX IE Error
The offending jQuery code: $.ajax({ type: "POST", url: "/?ct=rating&rt_v=rr&rt_rk=" + markerObject.number, dataType: "html", success: function(dataSet) { var status = $("status", dataSet).text(); if (status == "ERROR") { The error IE gives: Line: 173 Character: 6 Code: 0 Error Message: 'undefined' is null or not an object Line 173 is: if (status == "ERROR") { This code works just fine in FF and Safari. Any suggestions would be greatly appreciated. - Brad
[jQuery] jQuery AJAX Autocomplete with ASP .NET
Hi, How can I use jQuery AJAX Autocomplete script to call my AJAX method from ASP .NET instead of php.
[jQuery] JQuery Ajax Form Plugin
Hello, http://malsup.com/jquery/form/ I'm trying to implement the Form plugin in my site, but I have a problem. I use ajaxForm to make the form send the variables to email.php that interpret the httpPOST variables and send mail by php. This is working correctly in IE 7 but when I use firefox, it reloads the page by subsituting it by the email.php. Is this a known problem or is just me? Thanks. Pedro Mendonça
[jQuery] Jquery AJAX form submission
Hello, I am currently using Jquery's post method to submit a form. And I use the responseText to update certain other DIV in the page. Since I am migrating the All-No-AJAX pages to AJAX pages, I am forced import the entire HTML (not data alone) with Javascript into the existing DOM. Unfortunately $(document).ready(function(){}) doesnt get executed upon successfully receiving AJAX response. I guess this is the normal behaviour. But I would want that Javascript to be executed. The form plugin doesnt come to rescue since it doesnt support HTML type. Kindly advice on the right strategy to use. Work Around : To make it work, I have removed the $(document).ready() hook, and am calling the Javascript init() methods at the end of the page. I certainly know that this is not the correct approach. *$("form").submit(function(){ if(!$("#eFrm").valid()) { return false; } var pData = $("#eFrm").serialize(); $("div.mainContent").html("Loading"); $.post( './search.html?ajax=true',pData,function(data){$("div.mainContent").html(data);},"html"); return false; }); * -- Thanks Ram
[jQuery] Jquery Ajax and Struts Issue
Hi Experts - Jquery is able to call the regular servlets defined in the web.xml but was not able to call the struts action servlet? Any insight into the issue would be of great help!! Thanks,
[jQuery] jquery ajax post issue
Hello, My target page that which I would be loading via ajax has some java script to be executed on page loading. When I send the request directly thru the browser, it works fine. I mean the script gets executed. But if I load the page thru jquery ajax post method, the script doesnt get invoked. Is this the default behaviour? Should I execute the javascript as part of my ajax post call? Thanks Ram
[jQuery] Jquery, AJAX and MySQL update
Hi, I hope someone can help me with this. I've been reading jquery.com tutorials and others online to try and create a sortable drag and drop list which updates a mysql table using AJAX. After a few hours of head scratching I finally got most of it, but I'm stuck on the bit that passes the serialised data via AJAX to the script. Here is the script. $(document).ready(function(){ $("#list").sortable({ accept: 'item', update: function(sorted) { serial = $('#list').sortable('serialize'); $.ajax({ url:"updatesql.php", type:"POST", data: serial.hash, error:function(){alert('Failed');}, success:function(){alert('Success');} }); } }); }); If I replace the line "data: serial.hash" with "data: name=John&location=Boston" as in the jquery.com example then my "updatesql.php" file will run - obviously without the correct data. So I'm guessing that's the offending line. Can someone see an obvious problem? I can post the full HTML/PHP code if required although this is the offending bit. I'm using jquery-1.2.4a.js, ui.base.min.js, ui.draggable.min.js, ui.droppable.min.js, ui.sortable.min.js. Hope someone can help, Thanks in advance, Chris.
[jQuery] jQuery AJAX Dynamic File Download
I've got an export functionality built into my site, whereby users can choose which rows of a data table to export. They export by clicking an "Actions" dropdown and choosing "Export". This triggers an AJAX call that posts which ids to export to a PHP script, which, in turn, builds an Excel document on the fly and delivers it to the user. Here is my code: ... inputs = []; $("#dataTableBody input[id^=selected]:checked").each(function() { inputs.push(this.name + '=' + escape(this.value)); }); $.ajax({ type: "POST", data: inputs.join('&'), url: "/gateway/excel.php", success: function(){ return true; }, error: function(XMLHttpRequest, textStatus, errorThrown){ return false; } }); In Firebug, I'm getting the data in TSV format, but I'm not being presented the download dialog within my browser. If this was a straight file download, I would link directly to it, but the file has to be built dynamically. Can I set the dataType option in the ajax call to be "file" or something? What are my options?
[jQuery] Jquery AJAX Email Client ???
Hi, Does anybody know an ajax email client like this one ona dojo http://dojotoolkit.org/demos/email-using-1-0 ??? but in Jquery.
[jQuery] Jquery Ajax dropping special characters
I am trying to send an mysql query to the server from a client programme by using the jquery $.ajax({}) function. The query string comprises of + sign which is used to assign student grades (such as C+). The server side programming is in php. However I have realized at the time of sending the Ajax request jquery drops + signs from the query string. Is there any way to stop dropping of + character from the query string.
[jQuery] jQuery Ajax throws parseerror in IE
When using jQuery Ajax, I am receiving a parseerror in IE (Firefox & Safari work). Has anyone run into this before - and know how to fix it? Or something I can at least try. CODE >> object = { path : 'data.xml', data : 'lat=40.935&lng=-125.000' } $.ajax({ url: object.path, data: object.data, type: 'GET', dataType: 'xml', timeout: 1000, error: function(XMLHttpRequest, textStatus, errorThrown) { alert('Error loading data: ' + textStatus); }, success: function(xml){ ... } }); OUTPUT >> 'Error loading data: parseerror'
[jQuery] jQuery AJAX Docs
Are there any resources for newbies that explain how to do AJAX calls with jQuery ? Thanks, Dave Buchholz
[jQuery] jQuery AJAX load and encoding/charset problems
I have already spent hours and hours on the following problem. I am using jQuery's AJAX load method in order to put a portlet in a DIV. The portlet url is: http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/actueel.jsp Which is showing fine when called directly. However, when using AJAX to load the portlet into a DIV, this is the result: http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/ajax_encoding_test.jsp http://www.bam.nl/baminternet/baminternet/test/test_jQueryAjax/ajax_encoding_test.jsp As you probably can see, there seems to be some encoding/charset problem here. We are using the "ISO-8859-1" charset all over the website, except for the news portlet, which uses "ISO-8859-15" in order to support special Word-characters like euro signs, long dashes and so forth. I have tried to remove and put charset specifications everywhere, but nothing seems to help. Does anyone have a suggestion how to fix this? Thank you all very much in advance! Kind regards, Jesse Klaasse -- View this message in context: http://www.nabble.com/jQuery-AJAX-load-and-encoding-charset-problems-tf4669662s27240.html#a13339398 Sent from the jQuery General Discussion mailing list archive at Nabble.com.
[jQuery] JQuery AJAX with .NET - Limitations
I noticed the following problem in using jquery AJAX with .NET: NOTE: I don't have the below problems if I use AjaxPro, just wanted to do the same with JQuery. Is this is possible, or should I just stick with AjaxPro. 1) Cannot return a Datatable to the callback function [AjaxPro.AjaxMethod()] public System.Data.DataTable GetTestCaseById(int Id) { objTestCase.TestCaseCode = Id; return objTestCase.GetTestCaseById(objTestCase).Tables[0]; } var ResDataTable=Bubya.TestCase.GetTestCaseById(Id).value; if(ResDataTable!=null){ $('#testcase').value=ResDataTable.Rows[0] ["testcase_summary"]; } 2) Cannot post to a user control $(document).ready(function() { $.post( "wucPeopleList.ascx", { call_type: 'UpdateAccessRights', user_code: UserCode }, function(response){ } ); } );
[jQuery] jquery ajax problem
Hello everyone, I think Ill go go nuts! I already posted something about problem Im facing with but I didn't get the right answer so Ill try again by expaining my problem further. My PHP website is organised in following manner: MAin file is index.php and it includes other files. So, my "components" are included by setting URL for example index.php? kom=gallery. Everything in gallery file (and all others) is printed into global variable $htmlOutput.= and is echoed at the end of execution of index.php. Gallery file, for example, runs switch($_POST[task]) and calls different functions depending on value of ($_POST[task]. One function outputs HTML form where you can input username. I want to check if username is already taken by querying my database. Normal check would be by pressing submit button but I want ajax to check availability and to output message. For ajax check I've set a function fAjaxCheck() that is triggered by $_POST[task] = ajaxCheck. That function looks like this ajaxCheck() { //Find if DB has that us ername //if database returns so mething it means tahat usuername is already taken if(empty($result)) { //Username taken echo "no"; exit; } else { //Username ok echo "yes"; exit; } } I get my index php page html as a result!!! This is jquery Im using: $.post(\"index.php?kom=gallery\", { task:'is_username_taken',username: $('#username').val()}, function(data){ alert(data); }) I can't understand why do I keep getting this result. exit() at the and of if/else should stop script from working and my $htmlOutput variable at the end of index.php sholud never be echoed. Do you have any idea how to solve this? Why do I get all that html when I shold be geting only things from my ajaxCheck() function, thing I explicitly echo!? Thank you and sory for the trouble...
[jQuery] jQuery Ajax Bugs?
I have use jQuery to send AJAX call to PHP script using POST. It's always execute error function callback. I check using FireBug Firefox extention, the passed XMLHTTPRequest to error function callback has some of this value : readyState : 4 status : 200 responseText : {The expected response} statusText : "OK" Here some of my code : $.ajax({url:'inc/ msgboard.php'.url,type:'POST',dataType:'html',data:'name=F8R', success : function(passed) { } }, complete : function() { }, error : function(err) { alert(err ? err.responseText : 'Request GAGAL, silakan coba lagi beberapa saat.\nContent tidak ter-Update.'); } }); I'm using Windows XP and Apache 2.2 as test. Can someone help me ? The PHP header was set to text/html.
[jQuery] jQuery AJAX working in Firefox but not IE
Hey folks, So here's example code: You can see it in action (or inaction using IE) at http://delangeracing.com/points and clicking any "Prev" link. Any idea why it never fades back in using IE? -Josh
[jQuery] jQuery AJAX w/ ASP.NET
For the life of me, I cannot get jQuery working w/ ASP.NET. My front- end seems to call the .NET script, but once the script is processed, it's forwarding the browser to the ASPX result page rather than just returning the values. I've tried using $.ajax, $.post, the form plugin, just about every way a noob could think of with no results, posted is all of the code involved, maybe someone can make sense of this? HTML/JS code: http://www.w3.org/1999/xhtml";> Client / login $(document).ready(function() { var options = {beforeSubmit:validate, success:onData, dataType:"json"}; $("#loginForm").ajaxForm(options); }); }); function validate(formData, jqForm, options) { for (var i = 0; i < formData.length; i++) { if (!formData[i].value) { alert("Please enter a value for both Username and Password"); return false; } } return true; } function onData(responseText, statusText) { alert("status: " + statusText + "\n\nresponseText: \n" + responseText + "\n\nThe output div should have already been updated with the responseText."); } Client Streaming Media Manager / login username password Remember me next time? » forgot your password? .NET code: using System; using System.Data; using System.Data.SqlClient; using System.Configuration; using System.Collections; using System.Web; using System.Web.Security; using System.Web.UI; using System.Web.UI.WebControls; using System.Web.UI.WebControls.WebParts; using System.Web.UI.HtmlControls; using JSONSharp; namespace StreamingMediaManager { public partial class _Default : System.Web.UI.Page { protected void Page_Load(object sender, EventArgs e) { JSONReflector jr = null; using (SqlConnection sqlConn = new SqlConnection(Application["SqlConnectionString"].ToString())) { sqlConn.Open(); SqlCommand sqlCmd = sqlConn.CreateCommand(); sqlCmd.Connection = sqlConn; try { SqlParameter paramUserId = new SqlParameter(); SqlParameter paramClientName = new SqlParameter(); SqlParameter paramUserName = new SqlParameter(); SqlParameter paramPassword = new SqlParameter(); paramUserId.Direction = ParameterDirection.Output; paramUserId.ParameterName = "@UserID"; paramUserId.SqlDbType = SqlDbType.Int; paramClientName.Direction = ParameterDirection.Output; paramClientName.ParameterName = "@ClientName"; paramClientName.SqlDbType = SqlDbType.VarChar; paramClientName.Size = 100; paramUserName.Direction = ParameterDirection.Input; paramUserName.ParameterName = "@UserName"; paramUserName.SqlDbType = SqlDbType.VarChar; paramUserName.Size = 50; paramUserName.Value = Request["username"]; paramPassword.Direction = ParameterDirection.Input; paramPassword.ParameterName = "@Password"; paramPassword.SqlDbType = SqlDbType.VarChar; paramPassword.Size = 30; paramPassword.Value = Request["password"]; sqlCmd.Parameters.Add(paramUserId); sqlCmd.Parameters.Add(paramClientName); sqlCmd.Parameters.Add(paramUserName); sqlCmd.Parameters.Add(paramPassword); sqlCmd.CommandType = CommandType.StoredProcedure; sqlCmd.CommandText = "spProcessLogin"; SqlDataReader sdr = sqlCmd.ExecuteReader(); UserInfo ui = new UserInfo(); ui.ID = (int)paramUserId.Value; ui.UserName = paramUserName.Value.ToString(); ui.Password = paramPassword.Value.ToString(); ui.ClientName = paramClientName.Value.ToString(); Session.Add("UserInfo", ui); jr = new JSONReflector(ui); } catch (SqlException sqlex) { ErrorObject eo = new ErrorObject(); eo.Message = sqlex.Message;
[jQuery] JQuery & Ajax
Hello, I'm learning JQuery and Ajax, but i'm not using JQuery's built in Ajax method (wanna learn about Ajax on its own before I use JQuery's methods). A problem i'm running into is that I have functions in JQuery that I want to affect objects loaded by the remote scripting, but these functions appear to only affect objects when they are loaded with the initial page. An example of an effect I want is to load a div with ajax, and when the div loads have it fade to 0. Is there something I'm missing when it comes to applying JQuery to objects loaded by remote scripting? I tried applying a .load() event to the object and that didn't seem to work. Any ideas?
[jQuery] jQuery Ajax pagination
I'm looking an example using jquery for grid pagination with ajax(database hits) support. http://makoomba.altervista.org/grid/ haves a great example but using xml data. I'll want to use json instead. Do you know? Cheers
[jQuery] jQuery, Ajax Form and memory usage
Hi guys. I am discovering jQuery and i find it very attractive and useful. I just have a problem : I used to have a form which allows me to display pictures submitted on my website (to moderate them); it displayed 100 pictures at a time and for each picture, i choose if i delete it or not. It was working fine but it was really heavy (since once my form is submitted, i loaded the next 100 and so on and so on...). So i decided to use jQuery And the Ajax Form plugin to submit the form in ajax and load my next 100 pictures while the moderation processing is running, in order to save time! It's working great except that, the more pages i moderate, the more memory firefox is using (like 5 Mb more for each submitted form). Let me show you a piece of code : jQuery(function($) { $(function(){ prepareForm(); }); }); function prepareForm() { var options_form = { beforeSubmit: ** load my next 100 pictures **, error: ** what to do on error **, success: ** display a 'process done' message **, complete: prepareForm }; $('#MyForm').ajaxForm(options_form); } Using this method, i can submit the form "for ever" since the ajaxForm is set each time the process is complete. Does anyone have an idea about this issue? I think it's somekind of Firefox issue (it doesn't free the memory when i load my next 100 images). PS : excuse my english if it's wrong, i'm french ^^