Search Results

Search found 4827 results on 194 pages for 'alert'.

Page 59/194 | < Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >

  • json returning string instead of object

    - by peter
    i have $age = implode(',', $wage); // which is object return: [1,4],[7,11],[15,11] $ww = json_encode($age); and then i retrieve it here var age = JSON.parse(<?php echo json_encode($ww); ?>); so if i make alert(typeof(<?php echo $age; ?>)) // object alert(typeof(age)) //string in my case JSON.parse retuned as string. how can i let json return as object? EDIT: var age = JSON.parse(<?php echo $ww; ?>); // didnt work , its something syntax error

    Read the article

  • Looping through selected values in multiple select combobox JQuery

    - by Roland
    I have the following scenario. I have a combobox where multiple selection is available. <select id="a" multiple="multiple"> <option value="">aaaa</option> <option value="">bbbb</option> <option value="">cccc</option> <option value="">dddd</option> </select> Now I also have a button <button type="button" id="display">Display</button> When a user clicks on this button, it should list all the selected values of the dropdown in an alert box My JS code looks as follows $(document).ready(function() { $('#display').click(function(){ alert($('#a').val()); }); }); Any pointers will be appreciated

    Read the article

  • Does this popup view violate HIGS?

    - by brettr
    Will using a popup view to present a comment submission form violate the HIGS? I may have one popup with selections that goes to the final popup. Two popups back to back. This is more similar to a modal type of view than an alert or action sheet as described by the HIGS: http://developer.apple.com/iphone/library/documentation/UserExperience/Conceptual/MobileHIG/ModalViews/ModalViews.html#//apple_ref/doc/uid/TP40006556-CH11-SW1 under the section 'Using Modal Views'. Basically the type of view I'm shooting for is a combination of an alert with a custom view. It's sort of a mini view since it will be centered in the middle of the screen but not take up all of the viewing area. I'm fairly sure that is a violation however, but I'm looking for a few opinions on it. I believe what needs to happen is use a modal view, which will cover the entire view.

    Read the article

  • webservice doesn't get called by jQuery

    - by aspdotnetuser
    Hi, I want to call a webservice using jQuery.ajax() but the webervice doesn't get called. - If I change the url: to reference a .ashz file it gets called but not .asmx? Here's the code I'm using: jQuery.ajax({ type: "POST", url: "/services/CheckUsername.asmx/CheckUsername", // this doesn't get called //url: "/services/CheckUsername.ashx/ProcessRequest", this gets called data: '{ "context": "' + "username" + '"}', contentType: 'application/json; charset=utf-8', dataType: 'json', success: function (msg) { alert("Result: " + msg); }, error: function (XMLHttpRequest, textStatus, errorThrown) { alert("Error: " + textStatus) } The .ashz file gets called but a parsererror is retuned because it's returning http context - how can I modify this to get a string return type from a webservice? Thanks,

    Read the article

  • jQuery: how to handle empty return from getJSON

    - by Gee
    Alright so I have a php script which gets results from a DB, and to get those results I'm using a jQuery script to pull the results via getJSON. It works perfectly but now I want to do something if the php script returns no results (empty). I tried: $.getJSON('path/to/script'), {parameter:parameter}, function(data){ if (data) { alert('Result'); } else { alert('Empty); } }); But it's no good. I've tried different things like if (data.length) but still nothing. I've noticed that if there is no returned data the callback will never fire at all. So if that's the case, how do I handle a empty return?

    Read the article

  • Show friendly message on ASP.NET Ajax error

    - by balexandre
    You all know how annoying is this: I do have a log system and the correct error is well explicit there, but I want to give a better message to the user. I keep trying several ways but I'm using Telerik components and well jQuery and I ended up using both ASP.NET Ajax methods and jQuery, so I use function pageLoad() { try { var manager = Sys.WebForms.PageRequestManager.getInstance(); manager.add_endRequest(endRequest); manager.add_beginRequest(OnBeginRequest); manager } catch (err) { alert(err); } } as well $(document).ready(function() { ... } that alert(err) is never fired even upon OnClick events what's the best approach to avoid this message errors and provide a cleaner way? all this happens in <asp:UpdatePanel> as I use that when I didn't know better (3 years ago!) and I really don't want to mess up and build all again from scratch :( Any help is greatly appreciated Updated with more error windows after volpav solution

    Read the article

  • How do I return a variable from $.post() in jQuery? Closure variable?

    - by James Bao
    I am having trouble passing data retrieved from a $.post() function to use in other places in my code. I want to save the data as a variable and use it outside of the post() function. This is my code: var last_update = function() { $.post('/--/feed', {func:'latest', who:$.defaults.login}, function($j){ _j = JSON.parse($j); alert(_j.text); // This one works }); } alert(_j.text); // This one doesn't }; last_update(); //run the function Please help!

    Read the article

  • javascript traversing table

    - by user234194
    If I have a certain code, How do I traverse or get to the button(i.e type == INPUT) in JavaScript. <td> <div> <script></script> <script></script> <script></script> <input type="button"....../> </div></td> I tried doing: var cell = row.cells[0]; if (cell) { var btn1 = cell.firstChild; alert(btn.tagName.toUpperCase()); this resulted "DIV", and var cell = row.cells[0]; if (cell) { var btn = btn1.firstChild; alert(btn.tagName.toUpperCase()); this resulted "SCRIPT" But doing same (i.e firstChild ) , I could not succeed. Any help is appreciated. Thanks

    Read the article

  • How do I prevent form from redirecting after submission?

    - by Noor
    I have searched the site and I've found various solutions, most of them suggesting using return false; Problem is that I'm using this piece of code to submit the form: $(function() { $("#snd").click(function() { var dendar = "http://" + $("#inpt").val() + ":" + $("#pwd").val() + "secretsite.lol/something.xml"; $("#formen").attr("action", dendar); $("#formen").submit(); alert(dendar); return false; }); }); The alert is just there to let me know that the form has been submitted.. Thanks guys!

    Read the article

  • Get element using id problem

    - by Ebe
    I am modifying existing legacy webpages(which i shouldn't modify existing parts but adding) and the webpage uses document.write to write certain html elements. when i use <script type="text/javascript" language="javascript"> var v = document.getElementById('td_date_cal_0'); alert(v); </script> v becomes null and when i create button and click <input type="button" id="mnbutton" onclick="mnLoader();" value="Click Me!" />; <script type="text/javascript" language="javascript" > function mnLoader() { var v = document.getElementById("td_date_cal_0"); alert(v); } <br /> </script> Any idea, how to get the element without need of user action, such as clicking? Thanks, Ebe

    Read the article

  • Why is it bad practice to use links with the javascript: "protocol"?

    - by zneak
    Hello everyone, In the 1990s, there was a fashion to put Javascript code directly into <a> href attributes, like this: <a href="javascript:alert('Hello world!')">Press me!</a> And then suddenly I stopped to see it. They were all replaced by things like: <a href="#" onclick="alert('Hello world!')">Press me!</a> For a link whose sole purpose is to trigger Javascript code, and has no real href target, why is it encouraged to use the onclick property instead of the href property?

    Read the article

  • json jquery post request

    - by John
    <script type="text/javascript"> $(document).ready(function() { $("a").click(function() { var content = $('#content').html(); var data = {"content":content}; $.ajax({ type: "POST", dataType: "json", url: "ajax.php", data: {content:content}, success function (data) { alert('Hello!'); } }); }); }); </script> <div id="content"><?php echo $content; ?></div> ajax.php echo json_encode($_POST['content']); ?> Nothing happens... WhatI really want to achieve is to get that alert box and get the return data, but I am lost since I don't get any errors or nothing.

    Read the article

  • JQuery Ajax Always Fires Error Function

    - by CccTrash
    AddFileToDB.ashx: public void ProcessRequest (HttpContext context) { context.Response.ContentType = "application/json"; context.Response.Write("{ \"filename\": \"test.jpg\" }"); } JQuery: $.ajax({ url: 'AddFileToDB.ashx', dataType: 'json', success: function(data) { alert(data.filename); }, error: function(data) { alert('error'); }, }); This always results in the error function being called. I don't know why? Thoughts? AddFileToDB.ashx gets fired, but success never gets run.

    Read the article

  • Replace Infinite loop in Flex

    - by H P
    Hello, I want to access a webservice:getMonitorData() , on creationcomplete and returns an array, in an infinite loop so that the getIndex0.text is updated each time. Flex is not able to handle an infinite loop and gives a timeout error 1502. If I run the for loop until i<2000 or so it works fine. How can replace the loop so that my webservice is accessed continiously and the result is shown in getIndex0.text. This is how my application looks like: <?xml version="1.0" encoding="utf-8"?> <s:Group xmlns:fx="http://ns.adobe.com/mxml/2009" xmlns:s="library://ns.adobe.com/flex/spark" xmlns:mx="library://ns.adobe.com/flex/mx" width="400" height="300" xmlns:plcservicebean="server.services.plcservicebean.*" creationComplete="clientMonitor1()"> <fx:Script> <![CDATA[ import mx.collections.ArrayCollection; import mx.controls.Alert; import mx.rpc.CallResponder; import mx.rpc.events.FaultEvent; import mx.rpc.events.ResultEvent; [Bindable] public var dbl0:Number; //-----------Infinite Loop, Works fine if condition = i<2000------------------------ public function clientMonitor1():void{ for(var i:int = 0; ; i++){ clientMonitor(); } } public function clientMonitor():void{ var callResp:CallResponder = new CallResponder(); callResp.addEventListener(ResultEvent.RESULT, monitorResult); callResp.addEventListener(FaultEvent.FAULT, monitorFault); callResp.token = plcServiceBean.getMonitorData(); } public function monitorResult(event:ResultEvent):void{ var arr:ArrayCollection = event.result as ArrayCollection; dbl0 = arr[0].value as Number; } protected function monitorFault(event:FaultEvent):void{ Alert.show(event.fault.faultString, "Error while monitoring Data "); } ]]> </fx:Script> <fx:Declarations> <plcservicebean:PlcServiceBean id = "plcServiceBean" showBusyCursor="true" fault="Alert.show(event.fault.faultString + '\n' + event.fault.faultDetail)" /> </fx:Declarations> <mx:Form x="52" y="97" label="Double"> <mx:FormItem label = "getMonitorValue"> <s:TextInput id = "getIndex0" text = "{dbl0}"/> </mx:FormItem> </mx:Form> </s:Group>

    Read the article

  • Starting with an empty dataProvider for a <List>

    - by tictac
    I'm using a List which I need to be empty at the start. I'm adding items to it as needed by clicking a button. Since it's empty, I haven't added a dataProvider property <s:List id="thelist" itemRenderer="listIR" /> To add an item, I'm adding it to the dataProvider directly thelist.dataProvider.addItem() but when I do that, it gives me this error #1009: Cannot access a property or method of a null object reference. Also I have a debugging Alert in the listIR itemRenderer itself and I see that when the list is created, I get that alert twice as if 2 itemRenderers were created, even though the list is supposed to be empty at the start. Any ideas what's wrong with this itemRenderer? How do I start with an empty dataProvider and add items smoothly to it?

    Read the article

  • Can't set element ID in JavaScript, it's always undefined

    - by Dylaan Alith
    Hi, I want to have a function that generates ID's on the fly for a given jquery object, if it doesn't have one already. These ID's should then be used in future requests. I came up with the code below, but it doesn't work. The ID's are never set. The commented out alert statement below always return undefined. I always pass code like $(this) or $(options.el) as a parameter to substitute 'el'. Initially, the elements do not have explicitly ID set in HTML. Any help would be appreciated, here's the code: getElementId: function(el) { if(undefined == el.attr('id')) { el.attr('id',"anim-"+Math.random().toString().substr(2)); } // alert(el.attr('id')); return el.attr('id'); },

    Read the article

  • Why doesn't this work? jquery javascript

    - by mars
    $(document).ready(function() { musicList = new array() counter = 0; if($(".rA, .trA, .dA, .hA").length > 0) { /*$(".rA, .trA, .dA, .hA").each(function(e){*/ $(".hA").each(function(e){ $.post("/index/audio/ajax.track", { id: $(this).attr("rel") }, function(data){ /*THIS DOESN'NT WORK */ musicList.push(data.file); /*THIS DOESN'NT WORK */ alert(data.file);/*this words*/ }, "json"); counter++; }); if(counter>0) { alert(counter); } } }); I don't see anything wrong with the code but I have no idea why it won't work I just spent 3 hours trying to get it to work

    Read the article

  • Can't echo jquery (with ajax) variable in php

    - by Lars Kerff
    I'm trying to post a variable through ajax. But it won't echo the variable in php. This are the variables (these are working, seen in the log): $("#slider").bind("valuesChanged", function(e, data){console.log("min: " + data.values.min + " max: " + data.values.max);}); The Ajax part: $("#slider").bind("valuesChanged", function (e, data) { $.ajax({ type: "POST", dataType: "text", url: "../test.php", data: { minValue: data.values.min, maxValue: data.values.max }, async: false, success: function(data){ alert('yeah') }, error: function(xhr) { alert('fail') // if your PHP script return an erroneous header, you'll land here } }); }); </script> And php echo: <?php if ( $_POST ) { echo $_POST[ 'minValue' ]; } ?> Now why does it not echo the post? Thanks!

    Read the article

  • jquery draggable accept: classpath

    - by heldopslippers
    Hi guys.. I have problems with the following bit of javascript/jquery code: this.droppable = function(){ $('.imageWindow .body .item').draggable(); $('.groupWindow .body .item').droppable({ accept: $(".imageWindow .body .item"), over: function(event, ui) { alert("this is valid!"); }, drop: function(){ alert('dropped'); } }); } As you maybe know it is not possible to pass the following in the accept option: $(".imageWindow .body .item") But what is possible ? I want to pass a "class path" as an accept option ! It is probably a simple answer but i can't figure it out. Of course i could do: accept: ".item" But because "groupWindow .body .item" is a sortable it would also accept himself! Thanxs if you can help me!

    Read the article

  • Im having trouble getting SWFUplader to play ball in my codeigniter application

    - by Purplefish32
    I have this peice of code in my handler.js, I'm getting the correct serverData value throught ajax, ( Well it's echoed correctly un the alert box) but no matter what, i just cant seem to enter either of the 'if' blocks. I have double checked the type and it is a string. Something is definetly funky. function uploadSuccess(file, serverData) { try { var progress = new FileProgress(file, this.customSettings.progressTarget); alert(serverData); if(serverData == "uploadSuccess") { progress.setComplete(); progress.setStatus("Completed"); progress.toggleCancel(false); } if(serverData == "uploadError") { progress.setError(); progress.toggleCancel(false); progress.setStatus("Error: X"); progress.toggleCancel(false); } } catch (ex) { this.debug(ex); } }

    Read the article

  • How to make Dajax callback into scoped object

    - by BozoJoe
    I cant seem to find a way to make django-dajaxice have its callback inside same scoped object from which made the initial call. MyViewport = Ext.extend(MyViewportUi, { initComponent: function() { MyViewport.superclass.initComponent.call(this); }, LoadRecordsCallback: function(data){ if(data!='DAJAXICE_EXCEPTION') { alert(data); } else { alert('DAJAXICE_EXCEPTION'); } }, LoadRecords: function(){ Dajaxice.Console.GetUserRecords(this.LoadRecordsCallback); } }); var blah = new MyViewport(); blah.LoadRecords(); I'm on django, and like the calling syntax to django-dajaxice. I'm using Extjs 3.2 and tried passing a Ext.createCallback but Dajax's returning eval seems to only want a string for the callback.

    Read the article

  • Javascript data parsing in IE vs other browsers... It seems kinda screwed up. What's the deal?

    - by Carter
    Firstly, when I say other browsers I really only mean Firefox because that's all I tested in. Internet Explorer can parse a date followed by a single character as a proper date. Whereas Firefox behaves as I'd expect. For example... var dateString = new Date("1/1/2010f"); alert(dateString); In IE it will alert... Thu Dec 31 21:00:00 UTC-0900 2009 Whereas in FF is will spit out... "Invalid Date" I first noticed this using the jquery validation plug in. http://docs.jquery.com/Plugins/Validation/Methods/date It seems like it just subtracts some amount of hours off the actual date in IE when a character is appended. I've tested in IE6 and IE8. Am I missing something?

    Read the article

  • Jquery Ajax not receiving php response correctly

    - by Theo
    I'm sending a JSON response from php to jquery: foreach ( $obj as $o ) { $a[ $o->key] = utf8_encode($o->id); } die(json_encode($a)); my html/jquery code is: $.ajax({ type:'POST', url: "imoveis/carrega_bairros", data: ({cidade:10}), dataType:"json", success: function(ret) { alert(ret) if(ret.success) { // ... } else alert("error"); } }); The json response is perfect (i get it on the console), but jquery is receiving a NULL ret object and it alerts "error". What's the problem???

    Read the article

  • jQuery: extend plugin question

    - by Fuxi
    hi all, i'm having this simple plugin code: (function ($) { $.fn.tWeb = function () { var me = this; me.var1 = "foo"; this.done = function() { return this; } return this.done(); }; })(jQuery); var web = new jQuery.fn.tWeb(); alert(web.var1); works nice - alert(web.var1) is giving me "foo". my question: would it be possible extending this plugin by simply including another .js which has more code? eg. that i could ask for web.var2 i previously used a prototype function and could "extend" it by simply adding another js-include which refered to it eg. like tWeb.prototype.newfunction = function() how could this be done with jQuery? thx

    Read the article

  • JavaScript loop stops on "localStorage.removeItem"

    - by user1755603
    Why is the "localStorage.removeItem" stopping the loop? If I remove "localStorage.removeItem" and only leave the "alert", it loops though whole thing, but with "localStorage.removeItem" it stops on the first match. function removeTask() { for (i=0; i < localStorage.length; i++){ checkbox = document.getElementById('utford'+i); if (checkbox.checked == true) { alert(i); localStorage.removeItem(localStorage.key(i)); } } printList(); }

    Read the article

< Previous Page | 55 56 57 58 59 60 61 62 63 64 65 66  | Next Page >