Search Results

Search found 59301 results on 2373 pages for 'asp net ajax'.

Page 169/2373 | < Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >

  • Integrating legacy Ajax script in CakePHP

    - by octavian
    Hi, I have a legacy script that I would like to integrate in a cakephp app. The script makes use of $_POST and such and since I'm quite a noob I would need some help for the integration. Here is how the script looks like: THE JAVASCRIPT: prototype.js builder.js (these two are from the prototype fw) lib.js (makes a ajax requests to remote.php) THE PHP remote.php (contains FastJSON class and $_POST vars) if ($_POST['cmd'] == 'SAVETEAM' && $_POST['info']) { $INFO = json_decode(str_replace('\"', '"', $_POST['info'])); $nr = 1; $SORT = array($INFO->GK, $INFO->DEF, $INFO->MID, $INFO->FOR, $INFO->RZ); foreach ($SORT as $STD) foreach ($STD as $v) mysql_query("UPDATE players_teams SET fieldposition = ".$nr++." WHERE player_id = {$v->player_id} AND team_id = {$v->team_id}") or die(mysql_error()); // CAPTAION mysql_query("UPDATE `teams` SET captain = '{$_POST['captain']}' WHERE `user_id` = {$_POST['userid']}") or die(mysql_error()); } transfers.php (containts the form that uses the javascript and link to the JS) I have really no idea how to structure the files and calls in cakephp. Currently I have "Undefined index: cmd [APP/vendors/remote.php, line 230]" errors since I use $_POST['cmd'] (I placed remote.php in Vendors and included it, the JS was just included old fashion way, as a link and appears in the source code). How can I make this work? I'm sorry but I'm not familiar with AJAX and Cake... If you want a full look at the code, here it is: http://octavian.be/thecode.zip Thank you for reading and helping me out.

    Read the article

  • AJAX vs ActiveX/Flash for browser-based game

    - by iconiK
    I have been following the usage of JavaScript for the past few years, and with the release of extremely fast scripting engines (V8, SquirrelFish Extrene, TraceMonkey, etc.) the possibilities of JavaScript have increased dramatically. However, the usage share of Internet Explorer coupled with it's total lack of support for recent standards makes me want to drop a bomb on Microsoft's HQ, as it creates a huge amount of problems for any website. The game will need to be pretty dynamic client-side, with animations and other eye-candy things, but not a full-blown game like those that run directly in the OS using DirectX or OpenGL. However, this might be a little stretch for JavaScript and will certainly feel extremely slow in Internet Explorer (given that the current IE engine can be hundreds of times slower than SFX; gotta see what IE9 will bring), would it be better to just do the whole thing in Flash? I know this means requiring the plug-in AND I have no experience whatsoever with Flash (other than browsing YouTube :P). It also means I can't just output directly from PHP, I would have to use XML or some other format to pass data to it (JSON is directly integrated in JS and PHP can deal with it easily). Another idea would be to provide an alternative interface just for IE, though I don't know how (ActiveX maybe? or with Flash, then why not just provide it to all browsers) or totally not supporting it and requiring the use of other browsers, although this is plain stupid from a business perspective. So here am I, wondering what approach to take and thus asking for your advice. How should I build the client-side? AJAX in all browsers, Flash in all browsers or a mix (AJAX for "modern" browsers and something else for the "grandpa": IE).

    Read the article

  • JSF 2 f:ajax lifecycle problem

    - by gerry
    The problem is, that if a property is changed during an f:ajax request and a binded panelGroup should be newly created depending on that changed value, the old value is used. This code will explain the problem. Here is the backingbean TestBean: public String getFirst() { return first; } public void setFirst(String first) { this.first = first; } public String getLast() { return last; } public void setLast(String last) { this.last = last; } public String getName(){ return first+" "+last; } public void setDynamicPanel(HtmlPanelGroup panel){ } public HtmlPanelGroup getDynamicPanel(){ Application app = FacesContext.getCurrentInstance().getApplication(); HtmlPanelGroup component = (HtmlPanelGroup)app.createComponent(HtmlPanelGroup.COMPONENT_TYPE); HtmlOutputLabel label1 = (HtmlOutputLabel)app.createComponent(HtmlOutputLabel.COMPONENT_TYPE); label1.setValue(" --> "+getFirst()+" "+getLast()); component.getChildren().add(label1); return component; } and now the jsf/facelet code: <h:form id="form"> <h:panelGrid columns="1"> <h:inputText id="first" value="#{testBean.first}" /> <h:inputText id="last" value="#{testBean.last}" /> <h:commandButton value="Show"> <f:ajax execute="first last" render="name dyn" /> </h:commandButton> </h:panelGrid> <h:outputText id="name" value="#{testBean.name}" /> <h:panelGroup id="dyn" binding="#{testBean.dynamicPanel}" /> </h:form> After the page was initially loaded the outputText and panelGroup shows both "null" as first and last. But after the button is pressed, the outputText is updated well, but the the panelgroup shows again only "null". This is due to the problem, that the "binded method" dynamicPanel is executed before the update of the first and last properties. how can workaround this behaviour or what is wrong with my code?

    Read the article

  • Jquery Ajax json Serializable

    - by willsonchan
    I am learing using jquery ajax to hander the JSON..i writre a demo code. HTMLCODE $(function () { $("#add").click(function () { var json = '{ "str":[{"Role_ID":"2","Customer_ID":"155","Brands":"Chloe;","Country_ID":"96;"}]}'; $.ajax({ url: "func.aspx/GetJson", type: "POST", contentType: "application/json", dataType: 'json', data: json, success: function (result) { alert(result); }, error: function () { alert("error"); } }); }); }); <div> <input type="button" value="add" id="add" /> </div> i got a input and bind a script function to it, now the proble is comeing.. my C# functiong like that. [WebMethod] public static string GetJson(object str) { return str.ToString();//good for work } [Serializable] public class TestClass { public TestClass() { } public TestClass(string role_id, string customer_id, string brands, string countryid) { this.Role_ID = role_id; this.Customer_ID = customer_id; this.Brands = brands; this.Country_ID = countryid; } public string Role_ID { get; set; } public string Customer_ID { get; set; } public string Brands { get; set; } public string Country_ID { get; set; } } when i user public static string GetJson(object str) everything is so good.~~ no error at all but . when i try to use my own class TestClass. firebug tell me that "Type 'TestClass' is not supported for deserialization of an array." .any body can give me help:XD

    Read the article

  • PHP: Retrieving JSON via jQuery ajax help

    - by iamjonesy
    Hey I have a script that is creating and echoing a JSON encoded array of magento products. I have a script that calls this script using jQuery's ajax function but I'm not getting a proper response. This is the script that creates the array: $collection = Mage::getModel('catalog/product')->getCollection(); $collection->addAttributeToSelect('name'); $collection->addAttributeToSelect('price'); $products = array(); foreach ($collection as $product){ $products[$product->getPrice()] = $product->getName(); } header('Content-Type: application/x-json; charset=utf-8'); echo(json_encode($products)); Here is my jQuery: <select id="products"> <option value="#">Select</option> </select> <script type="text/javascript"> jQuery.noConflict(); jQuery(document).ready(function(){ jQuery.ajax({ type: "GET", url: "http://localhost.com/magento/modules/products/get.php", dataType: "json", success: function(products) { jQuery.each(products,function(price,name) { var opt = jQuery('<option />'); opt.val(name); opt.text(price); jQuery('#products').append(opt); }); } }); }); </script> I'm getting a response from this but I'm not seeing a any JSON. I'm using firebug. I can see there has been a JSON encoded response but the response tab is emtyp and my select boxes have no options. Can anyone see and problems with my code? Here is the response I should get: {"82.9230":"Dummy","177.0098":"Dummy 2","76.0208":"Dummy 3","470.6054":"Dummy 4","357.0083":"Dummy Product 5"} Thanks, Billy

    Read the article

  • Formatting Parameters for Ajax POST request to Rails Controller - for jQuery-UI sortable list

    - by Hung Luu
    I'm using the jQuery-UI Sortable Connected Lists. I'm saving the order of the connected lists to a Rails server. My approach is to grab the list ID, column ID and index position of each list item. I want to then wrap this into an object that can be passed as a parameter back to the Rails Controller to be saved into the database. So ideally i'm looking to format the parameter like this: Parameters: {"Activity"=>[{id:1,column:2,position:1},{id:2,column:2,position:2} ,...]} How do I properly format my parameters to be passed in this Ajax POST request? Right now, with the approach below, I'm passing on Parameters: {"undefined"=>""} This is my current jQuery code (Coffeescript) which doesn't work: jQuery -> $('[id*="day"]').sortable( connectWith: ".day" placeholder: "ui-state-highlight" update: (event, ui) -> neworder = new Array() $('[id*="day"] > li').each -> column = $(this).attr("id") index = ui.item.index() + 1 id = $("#" + column + " li:nth-child(" + index + ") ").attr('id') passObject={} passObject.id = id passObject.column = column passObject.index = index neworder.push(passObject) alert neworder $.ajax url: "sort" type: "POST" data: neworder ).disableSelection() My apologies because this seems like a really amateur question but I'm just getting started with programming jQuery and Javascript.

    Read the article

  • search form in php via ajax

    - by fusion
    i've a search form wherein the database query has been coded in php and the html file calls this php file via ajax to display the results in the search form. the problem is, i would like the result to be displayed in the same form as search.html; yet while the ajax works, it goes to search.php to display the results. search.html: <!DOCTYPE html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <script src="scripts/search_ajax.js" type="text/javascript"></script> </head> <body> <form id="submitForm" method="post"> <div class="wrapper"> <div class="field"> <input name="search" id="search" /> </div><br /> <input id="button1" type="submit" value="Submit" class="submit" onclick="run_query();" /><br /> </div> <div id="searchContainer"> </div> </form> </body> </html> if i add action="search.php" to the form tag, it displays the result but on search.php. i'd like it to display on the same form [i.e search.html, and not search.php] if i just add the javascript function [as done above], it displays nothing on search.html

    Read the article

  • jquery ajax post not working with .load in codeigniter

    - by bravo
    i wish to .load multiple views result with jquery ajax the original code (js) $(document).ready(function(){ $("#uid").change( function(){ var uid=$("#uid").val(); $.ajax({ type: "POST", url: "<?= site_url('sp_profile/ajax_userdetail') ?>", dataType: "json", data: "uid="+uid, cache:false, success: function(data){ $("#content").html(data); } }); return false; }); }); this return only one result in what if i want to load 3 results like in <div id="content"></div> <div id="content1"></div> <div id="content2"></div> content could be userid content2 could be user first name content3 could be user last name my js should using .load instead of html right? let me know if i'm wrong. success: function(data){ $("#content").load("<?= site_url('sp_profile/ajax_userdetail')?>"); $("#content2").load("<?= site_url('sp_profile/ajax_userdetail')?>"); $("#content3").load("<?= site_url('sp_profile/ajax_userdetail')?>"); } i stuck with this thing for whole day.. please anyone show me the right way to do the controller and js code.

    Read the article

  • jQuery code in ajax loaded content only runs once

    - by Michael Howland
    I have been looking around SO for a while and haven't been able to find anything that matches my issue, which I'm not even sure I can explain that well, so take that for what it's worth. I have a page that loads content into a div via AJAX (using the .load() method). There are several links in the navigation, meaning the content will change while navigating the site without refreshing the entire page. (Actually, to be honest, I just cribbed the DocTemplate layout [http://css-tricks.com/examples/DocTemplate/] from css-tricks.com. Apparently while I'm not a re-invent the wheel type programmer, I am a bash my head against the wheel incessantly to get it to work programmer.) So, index.php loads up some DB content in a div. There is also a jQuery UI modal input form on index.php. Essentially, the only HTML on the page is an empty div and a form. This all works fine, until I call up another page, then go back to index.php. The DB content is not loaded, and my form is shown there in all its naked glory. I know why this is happening. The page was not refreshed, nothing kicked off the code to load the content and hide the form. My question is, how can I ensure that the AJAX .load() and the .dialog() will run when loading index.php again? Is it even possible? Thanks, and my apologies for the length. I get verbose when I'm confused.

    Read the article

  • Newsletter send using AJAX to avoid PHP timeout

    - by simPod
    I need to send newsletters. I have already a PHP script that sends mass emails but it won't work for long as email database is growing because of PHP max script run time. So, to avoid it I came up with a solution: I would call my PHP script using AJAX in javascript and I will give it $_GET parameter with a count 20 so the script would sent only 20 emails. Than AJAX would receive success response, and call my script again and again till all emails are send. Is it possible? I'm asking because I have never seen such a solution so I'm wondering if it is real (It's kinda hard to implement this into my PHP framework so I'm asking experts here first) To sum it up here's a code skeleton: <script> var emailCount = 1000; //would get this from DB var runCount = 20; //number of emails sent in one cycle var from = 0; //start number function sendMail(){ if(from<emailCount){ jQuery.ajaxfunction({ path: 'script.php?from='+from+'&count='+runCount successFc: function(){ from+=runCount; sendMail(); } }) } } sendMail(); </script> So, are there any obstacles? Thanks a lot.

    Read the article

  • Javascript callback with AJAX + jQuery

    - by Fred
    Hey! I have this jQuery code (function () { function load_page (pagename) { $.ajax({ url: "/backend/index.php/frontend/pull_page/", type: "POST", data: {page: pagename}, success: function (json) { var parsed = $.parseJSON(json); console.log(parsed); return parsed; }, error: function (error) { $('#content').html('Sorry, there was an error: <br>' + error); return false; } }); } ... var json = load_page(page); console.log(json); if (json == false) { $('body').fadeIn(); } else { document.title = json.pagename + ' | The Other Half | freddum.com'; $("#content").html(json.content); $('#header-navigation-ul a:Contains('+page+')').addClass('nav-selected'); $('body').fadeIn(); } })(); and, guessed it, it doesn't work. The AJAX fires fine, the server returns valid JSON but the console.log(json); returns undefined and the js crashes when it gets to json.pagename. The first console.log(parsed) also returns good data so it's just a problem with the return (I think). I knew I was clutching at straws and would be extremely if this worked, but it doesn't. To be honest, I don't know how to program callback functions for this situation. Any help is greatly appreciated!

    Read the article

  • How to not use JavaScript with in the elements events attributes but still load via AJAX

    - by thecoshman
    I am currently loading HTMl content via AJAX. I have code for things on different elements onclick attributes (and other event attributes). It does work, but I am starting to find that the code is getting rather large, and hard to read. I have also read that it is considered bad practice to have the event code 'inline' like this and that I should really do by element.onclick = foobar and have foobar defined somewhere else. I understand how with a static page it is fairly easy to do this, just have a script tag at the bottom of the page and once the page is loaded have it executed. This can then attach any and all events as you need them. But how can I get this sort of affect when loading content via AJAX. There is also the slight case that the content loaded can very depending on what is in the database, some times certain sections of HTML, such as tables of results, will not even be displayed there will be something else entirely. I can post some samples of code if any body needs them, but I have no idea what sort of things would help people with this one. I will point out, that I am using Jquery already so if it has some helpful little functions that would be rather sweet¬

    Read the article

  • AJAX Post Not Sending Data?

    - by Jascha
    I can't for the life of me figure out why this is happening. This is kind of a repost, so forgive me, but I have new data. I am running a javascript log out function called logOut() that has make a jQuery ajax call to a php script... function logOut(){ var data = new Object; data.log_out = true; $.ajax({ type: 'POST', url: 'http://www.mydomain.com/functions.php', data: data, success: function() { alert('done'); } }); } the php function it calls is here: if(isset($_POST['log_out'])){ $query = "INSERT INTO `token_manager` (`ip_address`) VALUES('logOutSuccess')"; $connection->runQuery($query); // <-- my own database class... // omitted code that clears session etc... die(); } Now, 18 hours out of the day this works, but for some reason, every once in a while, the POST data will not trigger my query. (this will last about an hour or so). I figured out the post data is not being set by adding this at the end of my script... $query = "INSERT INTO `token_manager` (`ip_address`) VALUES('POST FAIL')"; $connection->runQuery($query); So, now I know for certain my log out function is being skipped because in my database is the following data: if it were NOT being skipped, my data would show up like this: I know it is being skipped for two reasons, one the die() at the end of my first function, and two, if it were a success a "logOutSuccess" would be registered in the table. Any thoughts? One friend says it's a janky hosting company (hostgator.com). I personally like them because they are cheap and I'm a fan of cpanel. But, if that's the case??? Thanks in advance. -J

    Read the article

  • ajax login problem

    - by rdanee
    $(document).ready(function() { $("form#login_form").submit(function() { var login_username = $('#login_username').attr('value'); var login_password = $('#login_password').attr('value'); type: "POST", $.ajax({ url: "login.php", data: "username="+ login_username +"& password="+ login_password, success: function(data){ alert(data); if (data == "ok"){ $('form#login_form').hide(function(){$('div.success').fadeIn();}); } } }); return false; }); Login.php: <?php include("settings.php"); $query = "select * from users where username = '{$_POST['login_username']}' and password = md5('{$_POST['login_password']}')"; $query = mysql_query($query, $connection); if ( mysql_num_rows($query) == 1 ) { print "ok"; $array = mysql_fetch_array($query); if ( $_POST['stay'] ) { $time = time()+2592000; } else { $time = 0; } } else { print "no"; } mysql_close($connection); ?> My problem: In the alert the message always "no" whether username/password is correct, however on the site "ok" appears when username/pw is correct. I have read the other questions in connection with this problem, but I couldn't solve the response problem from login.php with Json. Could you help me how should I response to the ajax calling? ( with a code if it is possible) Thank you very much, and sorry for questioning again.

    Read the article

  • using jquery selector to change attribute in variable returned from ajax request

    - by Blake
    I'm trying to pull in a filename.txt (contains html) using ajax and change the src path in the data variable before I load it into the target div. If I first load it into the div the browser first requests the broken image and I don't want this so I would like to do my processing before I load anything onto the page. I can pull the src values fine but I can't change them. In this example the src values aren't changed. Is there a way to do this with selectors or can they only modify DOM elements? Otherwise I may have to do some regex replace but using a selector will be more convenient if possible. $.ajax( { url: getDate+'/'+name+'.txt', success: function(data) { $('img', data).attr('src', 'new_test_src'); $('#'+target).fadeOut('slow', function(){ $('#'+target).html(data); $('#'+target).fadeIn('slow'); }); } }); My reason is I'm building a fully standalone javascript template system for a newsletter and since images and other things are upload via a drupal web file manager I want the content creators to keep their paths very short and simple and I can then modify them before I load in the content. This will also be distributed on a CD so I can need to change the paths for that so they still work.

    Read the article

  • jQuery and Ajax

    - by Banderdash
    Can anyone help with a jQuery snippet that would use Ajax to pull an XML file in on page load? Have really clunky way of doing it without jQuery here: <script type="text/javascript"> function loadXMLDoc() { if (window.XMLHttpRequest) {// code for IE7+, Firefox, Chrome, Opera, Safari xmlhttp=new XMLHttpRequest(); } else {// code for IE6, IE5 xmlhttp=new ActiveXObject("Microsoft.XMLHTTP"); } xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { xmlDoc=xmlhttp.responseXML; var txt=""; x=xmlDoc.getElementsByTagName("title"); for (i=0;i<x.length;i++) { txt=txt + x[i].childNodes[0].nodeValue + "<br />"; } document.getElementById("checkedIn").innerHTML=txt; } } xmlhttp.open("GET","ajax-response-data.xml",true); xmlhttp.send(); } </script> Ideally rather the having a click generate the list it would do so on page load, showing the fields from the XML (title, author, and whether it is checked in or not i.e. <book id="#" checked-in="0">) Would hug you for a solution.

    Read the article

  • css layout for footer at bottom with dynamic ajax content changing height of page

    - by m42
    [Update] I actually compromised on this problem for now by foregoing the fixed footer design. It seems that there is no problem with dynamic content moving the footer and resizing containers appropriately unless the footer is fixed to the browser bottom initially. I hope others will eventually provide a great solution that encompasses the best of both worlds. I spent all day trying to get the footer to move down the page to accommodate dynamically added (via ajax) content. I really need some pointers or links because I haven't found anything that helps. Basically: My site has some pages that begin with only a text box and a button so that the total height of the content area is only a few inches beneath the header area. I don't have any problem getting the sticky footer working so that the footer appears at the bottom of the browser window even when there is very little content on screen. That same css layout works fine for other pages that have content that extends beneath the browser window. The catch: The content has to be rendered and passed to the browser with the initial load. The Problem: Any content that is added to the page via AJAX after the initial load paints down the page correctly -- but the footer remains in its initial location. Please tell me there is a fix for this. I can't post the css until checking with my boss first - if possible - and if needed, I will later - but it's just a very basic version of the many sticky footer css solutions floating around the web. Thanks.

    Read the article

  • Ajax: strange behaviour while checking a textfield

    - by ilnur777
    I have a registration form with checking the available name for username field through ajax. Inputing a username into username field and pushing the "Check!" button, the script sends value to php script. Then php script replaces the username field with the username field + style like this: <input type="text" name="login" value="'.$_GET["user"].'" style="width:205; height:22; border-width:1; border-color:red; border-style:solid; background-color:rgb(255,232,230);"> So when replacing the username field in the form with its equivalent from php script and then submitting a form, it is then get to script on the page that checks whether the username field is empty or not. And it returns an error that it is empty, though after checking through ajax the username field it has value. I don't understand why it gets to empty field checking script, having the same field name and having value?

    Read the article

  • JQuery: how to store records id for data from ajax query in dynamicly created html elements

    - by grapkulec
    Probably question title is rather cryptic but I will try to explain myself here so please bare with me :) Let's assume this configuration: server-side is PHP application responding for requests with data (list of items, single item details, etc.) in json format client-side is JQuery application sending ajax request to that PHP app and creating html content corresponding with received data So, for example: client requests "list of all animals with names staring with 'A'", gets the json response from server, and for every "animal" creates some html gizmo like div with animal description or something like that. It doesn't really matter what html element it will be but it has to point exactly to specific record by "containing" id of that record. And here is my dilemma: is it good solution to use "id" property for that? So it would be like: <div id="10" class="animal"> <p> This is animal of very mysterious kind... </p> </div> <div id="11" class="animal"> <p> And this one is very common to our country... </p> </div> where id="10" is of course indication that this is representation of record with id = 10. Or maybe I should store this record id in some custom made tag like <record_id>10</record_id> and leave an "id" strictly for what it was meant to be (css selector)? I need that record id for further stuff like updating database with some user input or deleting some of "animals" or creating new ones or anything that will be needed. All manipulations will be done with JQuery and ajax requests and responses will be visualized also with dynamic creation of html interface. I'm sure that somebody had to deal with that kind of stuff before so I would be grateful for some tips on that topic.

    Read the article

  • jQuery AJAX PHP JSON problem

    - by Curro
    Hi Gurus I'm facing the problem of receiving an empty array when I do an AJAX request in the following way: This is the code I'm executing in JavaScript: <script type="text/javascript" src="lib/jquery.js"></script> <script type="text/javascript" src="lib/jquery.json.js"></script> <script type="text/javascript"> $(document).ready(function(){ /* Preparar JSON para el request */ var mJSON = new Object; mJSON.id_consulta = new Array; for (var i=0; i<3; i++){ mJSON.id_consulta[i] = new Object; mJSON.id_consulta[i].id = i; } var sJSON = $.toJSON(mJSON); $.ajax({ type: "POST", url: "getUbicaciones.php", data: sJSON, dataType: "json", contentType: "application/json; charset=utf-8", success: function(respuesta){ alert(respuesta); }, error: function (request,error){ alert("Error: " + request.statusText + ". " + error); } }); }); </script> And this is the code under PHP: <?php /* Decodificar JSON */ $m_decoded = $_POST; print_r($m_decoded); exit; ?> And all I get from this, using Chrome's Developer Tools is an empty array: Array ( ) Any clues on what am I doing wrong? The string sJSON is being encoded correctly, this is what I get when I do an "alert" on that one: {"id_consulta":[{"id":1},{"id":2},{"id":3}]} Thank you everyone in advance!

    Read the article

  • jQuery: AJAX call isn't updating page

    - by Cortopasta
    Thought I had a simple AJAX call using $.POST(), but apparently my function isn't firing, and nothing is updating :-/ Here is the call: $(".answerVerse ul li").click(function(){ var rank = $(this).removeClass("star_empty star_full star_highlight").attr("class"); var verse_id = $(this).parent().parent().find(".verseId").html(); var answer_id = $(this).parent().parent().find(".answerId").html(); var place = this; $.post("rank.php", { rank: rank, verse_id: verse_id, answer_id: answer_id },function(data){ $(place).parent().removeClass().addClass(data.newVerseRank); for (i=0;i<=5;i++) { $(".answerVerse ul."+i).each(function(){ $(".answerVerse ul."+i+" li."+i).prevAll().andSelf().removeClass("star_empty").addClass("star_full"); }); } }, "json"); }); And here is the PHP (rank.php) that it calls: require_once("dbcon.php"); $user = new user(); $user->updateVerseRank($_POST['verse_id'], $_POST['rank']); $user->getVerse($_POST['verse_id']); $user->getAnswer($_POST['answer_id']; $arr = array ('newVerseRank'=>htmlspecialchars(round($user->verse[3])),'newVerseVotes'=>htmlspecialchars(round($user->verse[4])),'newAnswerRank'=>htmlspecialchars($user->answer[3])); echo json_encode($arr); Why am I not updating the page? I know it's something dumb I'm doing seeing as how this is my first attempt at AJAX and JSON :-/ Just trying to learn

    Read the article

  • merge my code with Ajax code>>> problem

    - by sandy
    I want to help me In the following link i found nice code in Ajax http://www.w3schools.com/php/php_ajax_livesearch.asp I want to link my code with the code you see in the link above and replace dropdown list How can I do it for I could not where is it change in code even my code work as Ajax ?? I wish .... I wish .... I wish any somebody can help me <?php include ("connect.php"); print_r($_POST['sector_list']); $member_id = intval($_POST['sector_list']); if($member_id == 0) { // Default choice was selected } else { $res = mysql_query("SELECT * FROM members WHERE MemberID = $member_id LIMIT 1"); if(mysql_num_rows($res) == 0) { // Not a valid member } else { // The member is in the database } } ?> <form method="POST" action=<?php echo $_SERVER["PHP_SELF"]; ?> > <input type="hidden" name="sector" value="sector_list"> <select name="sector_list[]" class="inputstandard" multiple="multiple"> <option size ="40" value="default">send to </option> <?php $result = mysql_query('SELECT * from members') or die(mysql_error()); while ($row = mysql_fetch_assoc($result)) { echo '<option value="' . $row['MemberName'] . '">' . $row['MemberName']. '</option>'; } ?> <input type ="submit" name ="go" value = "go" > </select> </form>

    Read the article

  • Posting a form using Ajax

    - by hopes
    Hi everyone, do u have an idea of how to send my radio button name for myAjaxPostrequest.send(parameters); can parameters be like this: var answername=document.getElementById('option1').name; var parameters=answername; ? this code is for using ajax to post a form and my php page needs the name of the radiobutton clicked I tried this code and it works as I want except for inserting in the database. It means parameters is the problem what I want to insert is the number located between brakects of the radiobutton name. I could do it when I post form without Ajax but now I can't send the name of the radiobutton any clue about what I can send as parameter for function myAjaxPostrequest.send(parameters);? <form id="Question1" method="post"> <br /> <P> The sky color is.. </P><img border="0" src="images/wonder.png" width="94" height="134"/><br /><br /><br /> <input type="radio" id="option1" name="answer[1]" value="correct!" onclick="submitFormWithAjax();"/> blue <br /> <input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> red <br /> <input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> green <br /> <input type="radio" id="option1" name="answer[1]" value="false!" onclick="submitFormWithAjax();"/> white <br /> <br /> </Form>

    Read the article

  • jQuery and AJAX?

    - by Moshe
    I'm making a simple form which has 5 input elements for parts of an address. I use jQuery to build and send an AJAX request to a PHP file on my server. For some reason my jQuery is not properly able to read the values from my input elements. What could be wrong? Here is my jQuery: $('#submitButton').click(function(){ $('#BBRequestBox').html('<img src="images/loading.gif" />'); alert('Info: ' + $('#name').val() + ' ' + $('#street').val() + ' ' + $('#city').val() + ' ' + $('#state').val() + ' ' + $('#zip').val() + ' '); $.ajax({ type: "POST", url: "./bbrequest.php", data: {name: $('#name').val(), street: $('#street').val(), city: $('#city').val(), state: $('#state').val(), zip: $('#zip').val() }, success: function(msg){ $('#BBRequestBox').html('<p>' + msg + '</p>'); }, error: function(XMLHttpRequest, textStatus, errorThrown){ $('#BBRequestBox').html('<p> There\'s been an error: ' + errorThrown + '</p>'); } }); return false; }); Here is my HTML: <form action="#"> <label>Name:</label><input type="text" id="name" class="textbox"/> <label>Street:</label><input type="text" id="street" class="textbox" /> <label>City:</label><input type="text" id="city"class="textbox" /> <label>State:</label><input type="text" id="state" class="textbox"/> <label>Zip:</label><input type="text" id="zip" class="textbox" /> <input type="submit" value="Send Me a Bitachon Builder!" id="submitButton" /> </form>

    Read the article

  • Ajax Request using jQuery in Rails

    - by Steve
    Hi... I am sending an Ajax Request using jQuery. What happens is that I am getting an "405 Method Not Allowed" Error. I am just posting a form, which would get the detail from the form and insert it into the DB. Just the usual stuff.I am using WEBrick that comes as default with the rails package. Can somebody please tell me how to fix this. This is the code that triggers the Ajax Request $.post($(this).attr("action") + ".js",$(this).serialize(),null,"script"); Response Headers Cache-Control no-cache Allow GET, PUT, DELETE Content-Type text/html; charset=utf-8 Content-Length 9502 Server WEBrick/1.3.1 (Ruby/1.9.1/2009-12-07) Date Wed, 02 Jun 2010 20:41:33 GMT Connection Keep-Alive Request Headers Host localhost:3000 User-Agent Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.6; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 Accept application/json, text/javascript, */* 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 115 Connection keep-alive Content-Type application/x-www-form-urlencoded; charset=UTF-8 X-Requested-With XMLHttpRequest Referer http://localhost:3000/viewspot/3 Content-Length 141 Pragma no-cache Cache-Control no-cache

    Read the article

< Previous Page | 165 166 167 168 169 170 171 172 173 174 175 176  | Next Page >