I have a problem submitting my "form" with json. It is not a traditional form,
= "Snippet-code-js lang-js prettyprint-override">
$ ('# select'). ('Change', function {document.getElementById ("info"). Set attribute ("data-information", this.value);}) $ ('# info'). ('Click', function) {var id = $ (this) Data ('info'); Add (notification);}); Add Function {$ .ajax ({type: 'get', cache: false, contentType: content_type, beforeSend: function (xhr) {xhr.overrideMimeType (content_type);}, data: {'action': 'info_add ',' Info ': info}, url: Sitthid +' info / all ', success: function () {update ();}}); } & lt; Script src = "https://ajax.googleapis.com/ajax/libs/JQuery/1.1.0.0/jquery.min.js" & gt; & Lt; / Script & gt; & Lt; Select ID = "Select" & gt; & Lt; Option value = "1" & gt; Data 1 & lt; / Options & gt; & Lt; Option value = "2" & gt; Data 2 & lt; / Options & gt; & Lt; Option value = "3" & gt; Data 3 & lt; / Options & gt; & Lt; Option value = "4" & gt; Data 4 & lt; / Options & gt; & Lt; / Select & gt; & Lt; Div id = "info" & gt; Button & lt; / Div & gt; So as you see, when selected, this adds "data-information" attribute for div and when the div is pressed So it sends the data-data to the php script. And the problem is that it always sends the same value, but after refreshing it only sends it once and then again the same value as before. It's hard to interpret but the example is here: I think I select "Data 2" and press on the div. It sends "2" but when I change it to "data 3", and press it on the div, it still does not send "2", "3". Sorry for any cash set or nothing bad english and thanks in advance :)
If you If you are also going to use jQuery for settings, then read it with jQuery
Change
document.getElementById ("info"). SetAttribute ("Data-Information", this.value); to
$ "# info"). Data ("info", this.value); Still wondering why you are using data attributes, when you are not just reading the price on demand.
Add ($ ('# select') Val ());
Popular posts from this blog
I am trying to create Java web framework (and learning), and on the basis of 'Code Generator In the process of making the material view of the database in the process of development, I stumbled into a difficulty, which I do not know how to solve it. First of all, I want the following index.jsp : & lt; Body & gt; Use all pages to be created. & Lt;% @ include file = "header.jsp"% & gt; & Lt; Hours / & gt; & Lt;% @ included file = "body.jsp"%> & Lt; Hours / & gt; & Lt;% @ include file = "footer.jsp"% & gt; & Lt; / Body & gt; And, in body.jsp , I should have it like this: & lt; Jsp: include page = "$ {Application_modul}"%> Where application_modul is an attribute defined in its controller: request.setAttribute ("application_modul", "USER_ACCOUNT \\ ' View_user_account.jsp "); This file can be found properly, but the processed JSP does ...
I am trying to learn PDO, now I have written this small code, but it gives me a serious error: Fatal error: Call a member function at a non-object dot () ... $ con = new mysqli ("127.0.0.1", "root", "", "csvdangercheck"); $ Query = $ con- & gt; ("Id,` var1`, `var2`) values (" id,: var1,: var2) ";); $ query- & gt; bypass pattern (': id', $ id); $ query- & gt; BindParam (': var1', $ VAL1); $ Query- & gt; bindParam (': var2', $ val2); $ Query-> Executed (); I Trying to use print_r ($ con-> errorInfo ()) but Fatal error: Undefined method mysqli :: errorInfo ( ) ... can someone tell me what am I missing? Flaffeh said, you have PDO Missing Mysqy, try it: $ con = new PDO ('mysql: host = 127.0.0.1; dbname = csvdangercheck', 'root', '');
I am working on a simple audio player for a site. I just want to play it and stop the capabilities. I am working on it so that it can play, so set it so that the selector will try to play Kent overlap. After this is over, I want to re-select the selector. It does not seem like this to do so, maybe I do not understand where the bind and unbind should be kept. function play magic () {var audio element = document. Secrete element ('audio'); Var audio alarmsrc = $ (this) .attr ('data-audio-src'); AudioElement.setAttribute ('src', audioElementSrc); $ .Get (); AudioElement.addEventListener ("loadeddata", function () {audioElement.play ();}, true); $ ('. Pause'). Click (function () {audioElement.pause ();}); AudioElement.addEventListener ("Game", function () {$ ('. Play'). Unbind ('click');}); AudioAlement.Advent Allisoner ("Ended", function () {$ ('. Play'). Bind ('click');}); } $ (Function (...
Comments
Post a Comment