Link To $POST Variable?

Jan 29, 2011

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:

Code:

<a href="javascript:document.myform.submit()">111<img src="/images/covers/409-pg-01_sm.png" alt="" width="145"></a>

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.

View 3 Replies


ADVERTISEMENT

Make - Variable In POST

Jun 10, 2009

Is it possible to make

function post(test1,test2,test3,test4){
$.post('test.php', {
test1: test3,
test2: test4
}, function() {
lert('yes');
});
}

the test1 in red to be what is comming from the function?

[Code]....

View 2 Replies View Related

Post A Picture With Link In Forums?

Sep 21, 2010

How to post a picture with url link in the forums .if we click that picture means it will goes to my target url . how to create this link ?

View 3 Replies View Related

JQuery :: How To Post Back A Variable

Nov 22, 2010

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.

View 3 Replies View Related

Passing A JS Variable To Python Using Post And Cgi-bin?

Aug 15, 2011

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!">

[code].....

View 1 Replies View Related

Ajax :: Using The Variable Inside Post

Aug 12, 2009

In my application i am using Ajax post like:

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:

And my Model saveForms is like:

And my save_form.ctp in my views folder is like:

View 6 Replies View Related

Ajax :: Won't Submit A POST Variable

Jun 9, 2010

I have my ajax create a form which sends its data to a PHP script.

But when i check the PHP script it only gets the $_POST['user'] the $_POST['message'] doesn't come through.

Why might this be ?

My AJAX:

Code:

Focus on:

Now the next part recives it and submits:

Code:

View 4 Replies View Related

JQuery :: Set Global Variable With Results Of $.post?

Oct 26, 2011

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.

View 3 Replies View Related

JQuery :: Open A Link And Send To It A Post Request?

Jun 30, 2009

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>

[Code]....

View 1 Replies View Related

JQuery :: Variable Keys In A Ajax Post Call?

Sep 21, 2009

How do I pass a variable as a key in a key/value pair in Ajax?

[Code]...

View 2 Replies View Related

JQuery :: Passing A Variable From A Post Callback Function?

Oct 23, 2010

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

$.get("delete.php", { delete: $(this).parent().parent().parent().attr('id') },
function(data){
if(data != 'ok') {

[code]...

View 1 Replies View Related

Using Button To Trigger Confirmation Window And Then Post A Variable?

Jul 3, 2010

<fieldset class="submit" style="padding-left: 200px;">
<?php if ($site_exist >= 1){
echo "<input type="submit" name="submit" value="Update">";

[code]....

View 1 Replies View Related

JQuery :: AutoComplete - Post A Variable If Option Is Selected?

Feb 3, 2009

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.

View 5 Replies View Related

JQuery :: Access Variable Inside Callback Function Of Post?

May 4, 2010

<script type="text/javascript" src="jquery-1.4.2.min.js"></script>
<script type="text/javascript">
var global_var = false;
function test_func() {
$.post("server.php", function(data){
alert("Data Loaded: " + data);

[Code]...

View 2 Replies View Related

JQuery :: Ajax Post - Accessing Return Data / Result Variable

Nov 30, 2010

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).

View 1 Replies View Related

Text Element In Form Created With CreateElement Can't Pass Post Variable?

Nov 16, 2011

My code is this:

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.

View 7 Replies View Related

Create A Variable Link

Jul 23, 2005

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?

View 1 Replies View Related

Href With Variable In Link

May 21, 2006

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.

View 6 Replies View Related

Pass A Php Variable To A Function Using A Link

Apr 17, 2010

I am trying to pass a php variable to a javascript function using a link but it doesnt get through.

Code:

View 10 Replies View Related

Passing A Variable As A Link For Php Usage?

Apr 13, 2010

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:

<?php session_start();?>
<html>
<head>

[code]....

View 2 Replies View Related

Creating Html Link Using Variable?

Apr 12, 2011

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?

Cell.innerHTML = "http://localhost/Project/+File";

View 1 Replies View Related

Jquery :: Post - How To Make The Variable Data - [data] - Dynamic?

Aug 21, 2009

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,

PHP Code:
<form action="send_xml.php" method="post" enctype="multipart/form-data" id="form_send"><input type="checkbox" id="var_1" class="checkbox"/><input type="checkbox" id="var_2" class="checkbox"/></form> 

[Code]...

View 2 Replies View Related

JQuery :: Creating Php Sessions Variable When A Link Is Clicked?

Aug 16, 2011

I'd like to use $.post to create php session variables on the fly when a link is clicked, and then let the browser follow the href content.

[Code]...

View 4 Replies View Related

Link / Function - Set Source Of A Frame Equal To A Variable?

Apr 18, 2011

set source of a frame equal to a varialble:

Code:
<script type="text/javascript" language="javascript" >
//test
function makelink()
{
var qual = '';
//set stud = mm_adl_API.LMSGetValue(""cmi.core.student_id")
[Code]...

View 1 Replies View Related

JQuery :: Ajax Post Success - Run An External Function Outside The Post

Aug 17, 2010

I want to run an external function outside the post.

This is what I have currently.

On success of the post I want to run the setGrandTotal(); function which will do some calculating for me.

View 1 Replies View Related

JQuery :: Use $.post() To Post Array Of Controls?

Oct 11, 2011

How can I post array of controls through &.post() in jQuery??I have some of checkboxs in my page and declare them like this

<input name="mycheckbox[]" "value="myvalue" type="checkbox">

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

$.post('ajax/test.php", {checkbox: $
(
'input[name="mycheckbox"]'
)});

[code]....

View 1 Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved