When an image is clicked, I need to generate a variable which is then passed to a .php page. The variable is simply a 3-digit number. I was thinking of something like this:
Which I found by googling it, but I don't know what to substitute for the document.myform.submit in my own code. I also don't know how to use the variable.
I am trying to write code to allow a person select one photo to be their base image or Front cover image on a photo album. I am using jquery .post to get the form check box values which are the image file names and then use post to throw them to a php file and then update the database.
Now thats cool so far and that part works. Now the problem is that I need the main photo album picture to be replaced once the .post if completed or succeeded. I need to refresh the main image. Right now the only way to do it is to hit the refresh button on your web browser. Yet I want to do this without refreshing the page.
The Image displayed already is in a image html tag with a id named user_main I was thinking is it possible for .post to pass back to javascript a variable that has the image source and is there any way to update that image tag easily like where it says src="path to image" is located.
Would like to know the best way to refresh the image without having to refresh the page.
I am trying to create a button on a webpage with HTML/JS that upon clicking will 1) pass a single variable into my python script and 2) run the script. The single variable to be passes is already a declarative variable in the html page.
var userid=urlvar['userID'];
I have an instance implemented using cgi-bin that takes some user information from the form (detailed below A) and calls a python script (see below B) to return a new page displaying that information. I am looking for a way to pass the value from var userid as the "form.value" and then use that value for some specific processing objectives already designed (I have no need to return any information to the webpage).
A---In the html page:
<form method="POST" action=http://ip_address/cgi-bin/test_doneButton.py> <p>Your first name: <input type="text" name ="firstname"> <p>Click here to submit form: <input type="submit" value="Yeah!">
The Form id as returned from the Controller side is saved in the variable getformid correctly, But it is not reflected in the savefield ajax post..And it is saving as 0 only even it alerts as the returned Form id..
In addition i am giving here the Code inmy Controller for saveForm:
In this function, I'm trying to set the value of isValid with the results of $.post:
[Code]...
Unfortunately, isValid never changes from the initial "true". I know that $.post is working correctly because #msg_code reflects the corresponding message.
I was guessing if it was possible, using jQuery, to have a link that, when clicked, opens the relative url and sends to it a post request. I'm trying to do this with the $.post function, but i found the problem that the request is sent, but the page isn't opened.
This is my code: <html> <head> <script type="text/javascript" src="jquery.js"></script>
I can't seem to get a variable declared from within a post callback, so that I could manipulate my script accordingly. I have delete.php, that deletes an id from a mysql db. If it fails, I want the script to stop and display the error. The .php script echos an "ok" if everything went fine, if not - it echos the error.var abort_error; // set the error variable
I am using a jQuery AutoComplete plugin which fills in text as you type. I need to find a way when the page is submitted (submit.php) to determine if the user choose a company from the list, or if they typed in their own unique company.
If an option is selected, can i have jQuery post an extra $_POST variable like "new" or "existing" so I can pick it up on the submit.php page? Or when an option is selected, can I have .js write a hidden tag which contains the variable "existing"?
[URL]
index.php
Code HTML4Strict: <script type="text/javascript"> function findValue(li) { if( li == null ) return alert("No match!");
[Code].....
The end goal here is to post a variable on the next page if the user selected an option from the autocomplete list.
So I'm currently working on a ASP.NET Webforms site and I've run in to a small problem. On my .cs file I have the following Webmethod
[WebMethod] public static string IsJobEditable(int jobid){ try{ string isEditable = "false"; JobsBLL jbl = new JobsBLL(); int jobStatusId = jbl.GetJobStatusId(jobid); //If the jobs is either waiting or being edited it is okay to edit it if(jobStatusId == Convert.ToInt32(ConstantsUtil.JobStatus.Waiting) || jobStatusId == Convert.ToInt32(ConstantsUtil.JobStatus.Edit)){ isEditable = "true"; }return isEditable; }catch (Exception ex){ throw ex; }}
This function in this case will ALWAYS return TRUE as a string. On Aspx page I have the following $(function () { $.ajax({ type: "POST", url: "Coordination.aspx/IsJobEditable", data: "{jobid:" + jobid + "}", contentType: "application/json; charset=utf-8", dataType: "text", success: function (result) { alert(result);
//This is written out in the alert {"d":"true"} I want this in a variable as a string so I can do a check on it before I do some other actions. The format is not a String so I cannot split on it to retrieve the "true" part. }, error: function (err, result) { alert(err); } });});
As you can see in the comments the value I get back in the Callback method is in to me a weird format. The type is unknown and I need this value to be able to proceed with my entire method surrounding the small portion of the Javascript. Where to access the result variable / data as a var or anything else that will let me put it into a var (as a string).
Code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html lang="EN" dir="ltr" xmlns="http://www.w3.org/1999/xhtml"> <head>
[Code]...
In a few words it creates a button which when it is clicked it launches the add_text script. Add text script creates a text element for a form and puts a random value for the textbox. Textbox also takes a name which is of array type name="txt[]". Also form has the post method.
When I press e.g. 4 times the add text field button 4 text boxes are added. But when I click the submit button I get a result of 1 instead of 4 when the print count($txt) is executed. Copy paste the code to see the problem.
I must begin to say that I'm rather new in wtiting and using JavaScript. Now I want to use JavaScript in a HTML-page. On the homepage is a link. Every time the homepage is displayed the link must point to another target. I want to realize this by having a lot of differet targetpages. The names of these pages are p1001.htm until p<nnnn>.htm. At this moment the last is p1153.htm, but the amount is increasing every day.
I have a file named "counter.txt" which contains one line with the string of the last targetpage, at his moment "1153".
My idea is to have a JavaScript which: 1. reads the file counter.txt to determine the last available page 2. then takes at random one number between 1001 and 1153, 3. sets the HREF-link to page p<random>.htm.
I know it must be possible in JavaScript, but can anyone help me?
I am trying to make a variable link on a page. The page has a text box for a stock symbol. The code is: <input type=TEXTBOX Name="symtb" value="" size="10>
The value of the text box {the stock symbol} will complete the url.
I found code for a variable link: <script language="JavaScript"> <!-- function variable_in_link(varible_value) { new_win = window.open('http://finance.yahoo.com/q?s=" + varible_value'') } // --> </script>
The link I am trying to use is: <a href="javascript:variable_in_link(symtb)">The text</a>
No matter what I do the variable_value comes back as undefined. There is always a value in the text box.
I have a simple page and a javascript that measure the time the user has spent on a page and I want that variable to pass as a link to another page (php). I'm stuck (rookie) with how to actually pass that on in the link.Here's my code:
I'm using a form data reference, something like P-1234 for example to create a text file and a link to the file. This is during the construction of a new table or table row with javascript. I have an array of one or more references submitted via form using $_POST. On my action page I am creating a txt file P-1234. If I am creating a table ot table row using createElement(), one of the cells will have a link to the file. If the file is created as follows:
$File = $_POST['ref'][$i] . "txt"; After creating the cell var Cell = document.createElement('td');
[code]....
I assume the link is inserted using innerHTML? If so, do I just append the filename to the end of the file path like this?
I wonder if i can make the variable data which is [data] in jQuery.post( url, [data], [callback], [type] ) dynamic. for instance, this is the form i want to send,
I can get it works if I using <form> tag with an action="post" and a submit button to post to another php page by using this statement to get all controls in receiver's page _GET['mycheckbox'];I have tried