Tag: ajax

Parse json array in jquery php

I am new to JSON, and I am trying to get the JSON response and then parse it in jquery. Here is my sample code, $.ajax({ type: “GET”, url: ‘ajax-script.php’, data: { TERMINAL_CODE: value }, success: function(data) { $(‘#arrivals’).html(data.Success); //alert(data.length); } }); ajax-script.php $code = $_GET[‘TERMINAL_CODE’]; $jsonData = ‘{“Success” : true ,”Response”: [{ “TERMINAL_CODE”: 16, […]

$.getjson IE-specific error

By using a for-loop to ask the server for several database entries I wrote a piece of code, which works proper good, BUT: Magically this piece of code doesn´t work on the IE11. For Google Chrome, Firefox, Safari, …, it works porper good. But unfortunately I need to use IE11. The code doesn´t give an […]

Extract json data from ajax response

Here is my js function <script> function get_class_group(class_id) { $.ajax({ url: ‘<?php echo base_url();?>index.php?admin/get_class_group/’ + class_id , success: function(response) { var obj = response; alert(obj); } }); } </script> This gives me output like [{“section_id”:”13″,”name”:”A”,”nick_name”:”A”,”class_id”:”13″,”group_id”:”4″,”teacher_id”:”6″,”id”:”4″,”group_name”:”Science”}] [{“section_id”:”13″,”name”:”A”,”nick_name”:”A”,”class_id”:”13″,”group_id”:”4″,”teacher_id”:”6″,”id”:”4″,”group_name”:”Science”}, {“section_id”:”22″,”name”:”B”,”nick_name”:”b”,”class_id”:”13″,”group_id”:”4″,”teacher_id”:”0″,”id”:”4″,”group_name”:”Science”}] If i write alert(obj.section_id); it gives me error:”undefined”. How can i get a specific value from this json? […]

Is there a way to see a trace of the executed JavaScript in Firefox without using Firebug?

Update: Thanks for the responses so far. To clarify, I’m not really looking for a logger, but more of a debugger/tracer — I want a dump of every piece of JavaScript that executed and when it executed. I tried Venkman earlier today but it isn’t very stable. My theory is that something is going wrong […]

Execute PHP without leaving page

Okay. I have a form – textarea (named “su”) and submit button. When the form is submitted, I need to run a PHP script without refreshing/leaving page “echo” or somehow print a return on the screen I’m pretty sure this works via some kind of ajax request thing. but I have no idea what I’m […]

Ajax sending multiple request on form submit

What is happening here is when i click on the button first time it will not work, when i click 2nd time then it sends ajax request if, run it again then it will send *2 request of the last time request sent. here is my code <?php $this->load->view(“header.php”); $this->load->view(“sidebar.php”); ?> <style type=”text/css”> .form-group .error{font-size: […]

onreadystatechange function not being called

For some reason, onreadystatechange call back function is not being called in asynchronous mode. I tested the post in synchronous mode and confirmed that post itself is working fine (commented out testing code I used to check post in synchronous mode). The problem occurs both in safari and firefox latest version. Can someone please tell […]

Php returning blank in ajax request

I’m trying to return a simple echo from my ajax request, and I’ve done it before, but cant work out why its not working this time! I’ve stripped it down to the bare minimals and its still not working. Javascript function getUserColours(){ var username = $(‘#username’).val(); $.ajax({ url: ‘assets/processes/loginUserColour.php’, // URL of php command type: […]

Can Response.Redirect and OnBeforeUnload play nice together?

Does anyone know how to detect in a OnBeforeUnload event that the server side code sent a Response.Redirect? I want to prompt a user to keep them from moving away from a page before it’s time, but when the server redirects I it shouldn’t prompt the user. I’m working with legacy code that extensively uses […]

Is it possible to send an AJAX request on load?

Hello I have two dependants select box, the second one is popularited after onchange event. The first one is loaded with a selected value (selected=selected), what I’m asking, it is possible to send the requested while the page is loading, ie as I have the the selected option, just send the request. Javascript function getXMLHTTP() […]