Sending $_posts Inside Javascript If Statement

Mar 25, 2006

I have interrupted a login process (going to another interim page) to access the database and retrieve the zip code of the customer (don't ask :-). so they can agree or disagree (disagree is a javascript:back)

there are 3 $_post variables which i need to send on from within a confirm() to the login script.

Can this be done? They have to be $_post, rather than $_get

Is there a php alternative to the confirm? ( if so, i'm in the wrong place!!)

View 7 Replies


ADVERTISEMENT

Sending Data Inside .js File?

Sep 14, 2010

I have several functions in a .js file that collect various types of information from the visitor, let's just say they are strings, and want to send that information to my database. I have no problem putting the information in my database once I get everything into PHP (I'm relatively new to JS).

Am I able to make a form in the .js file and automatically submit it once all the functions finish? I also need the page not to refresh when sending this information so I'm assuming some AJAX will need to be involved. I was able to send a basic form using some jQuery I found and have the page not refresh but can't figure out how to do the same in a .js file.

<script type="text/javascript">
// wait for the DOM to be loaded
$(document).ready(function() {
// bind 'myForm' and provide a simple callback function
$('#myForm').ajaxForm(function() {
});
});
</script>

View 1 Replies View Related

Function Definition Inside 'if' Statement

Oct 19, 2005

I debugged some html file and found this:

------------------------------------------------------------
<script language="JavaScript">

if ( some_statement ) {

function MyFunction ( some_argument ) {

some_function_statements;

}

}

</script>
------------------------------------------------------------

Is it allowed to define a function INSIDE some 'if' statement?

View 8 Replies View Related

JQuery :: If Else Statement Inside Each Loop

Aug 3, 2010

I'm currently trying to produce an HTML table from an XML feed, using jQuery. And this works great! With an "each" loop, there now is a nice table on my screen, displaying the right information from the feed.

I would like for each new row of this table to have a separate color. For example:
row 1 - blue
row 2 - green
row 3 - blue again
row 4 - green again
...
and so on...

What I've tried, is putting something like this inside the loop:
var
x=0
(this line should probably be outside of the loop, but that doesn't seem to work)
if
(x=0)
code 1...
x=x+1
else
code 2...
x=x-1
But this doesn't work.

View 2 Replies View Related

Change Background Image With If Statement Or Call Function Inside Of If?

Jan 17, 2010

Basically I want to have a different background image for every time of the day. The function by itself works okay with onclick or onload placed in body.

function changesky()
{
document.getElementById("sky").style.background="url(back_morning.jpg) repeat-x";

[code]....

View 5 Replies View Related

Sending An Array From Php To Javascript

Mar 29, 2006

i have made an application in php so that people can make, on the fly, a
form. when they submit the form there is a javascript formvalidation.

because we do not know how many fields there are in the form (it is made on
the fly) i collect all the form fieldnames in an php array and sent it to
the javascript function: Code:

View 5 Replies View Related

Sending Mail Using Javascript

Jul 20, 2005

I'm would like my app to send a preformatted email(with subject and
body) everytime a user pushed a button, like : onclick "
mailto:this@that.com" , without the user seeing anything, i.e. not
being able to edit the message.

Using php, this is very simple; mail("this@example.com", "Subject",
"Line 1
Line 2
Line 3");

is there a way to do this the same, easy way using javascript?

View 4 Replies View Related

Sending An Email By Javascript

Jan 10, 2006

I am using a javascript to format an email, the problem is that when the user clicks the submit button they are presented with the email and they have to click send in the email. Is there anyway to do this without the email being shown to the user?

I am able to do it using a simple mailto: but this prevents me from formatting the body of the email and other functions I need.. Code:

View 5 Replies View Related

Sending Parameters To XSL Via Javascript

Feb 13, 2006

I am new to XSL and was wondering how I would send a parameter to my XSL stylesheet?

I currently am using this Cross-Browser XML/XSLT javascript code to perform my transformations. Code:

View 1 Replies View Related

Sending A Form Created By Javascript

Aug 11, 2005

I have this function:

var CntEmails=0;
function CreateEmails(id,name){

//passo1: criar elementos
br1 = document.createElement('BR');
emailText=document.createTextNode('email:');
email = document.createElement('INPUT');

// passo 2: anexar elementos
gEBId(id).appendChild(emailText);
gEBId(id).appendChild(email);
gEBId(id).appendChild(br1);

// passo 3: definir tipo de campos
email.type='TEXT'

// passo 4: definir value
email.value=CntEmails;

// passo 5: definir name
email.name=name+CntEmails;

// passo 6: incremental contador
CntEmails++;
}

gEBId() -> means getElementByID();

Using the function:

HTML Code:
<input type="button" onclick="javascript:CreateEmails('emails','email');" value="+">

<div id="emails">
</div>

This function works fine (thanks to sitepoint users).

But I cant send the variables by a post method. If I try in php: print_r($_POST) or var_dump($POST) I just get the static fields.

View 5 Replies View Related

Sending Web Pages Containing Javascript Using MS Outlook Express

Jul 20, 2005

Has anyone tried sending web pages containing javascript to another user
also using Outlook Express?

Mine don't work on the other end - although I'm not sure if this is because
they don't have Javascript enabled in MS Explorer 6. I save the entire HTML file + script into my Stationery folder. Then I select Message/New Message Using [select stationery file]. Should it work? Say I sent this by email:

<html>
<head>
<script>
alert("Hi there!");
</script>
</head>
<body>
<p>Can you see the alert box? Let me know.</p>
</body>

</html>

View 3 Replies View Related

Need Help With Mathmatical Javascript Statement

Mar 3, 2006

I am looking at a line of code in javascript that I dont understand...

var ad = n % nn;

What I dont understand is what the % represents as a mathmatical
function in javascript.

View 2 Replies View Related

Javascript Case Statement

Mar 3, 2006

I am writing some javascript code and just wanted to check if a case statement could have OR / AND. If yes, what would the syntax be like.

What I need is this:

switch (country) {

case "US" || "Canada":
//do something
break;
case "Australia" || "UK":
//do something
break;
}

I can alternatively use IF statement but was curious.

View 2 Replies View Related

How Can I Embed JavaScript Function Calls In A Document.write Statement?

Jul 23, 2005

I am getting syntax errors in my JavaScript code, code snippet as follows
(between my <script></script> tags:

View 2 Replies View Related

Sending Values From Server Side To Client Side Javascript

Jul 20, 2005

I have a Hyperlink within a String like below:

sSql = "SELECT DISTINCT " + "'Action' = '<center><a
href='+char(34)+'ChangeRequest.aspx?ID='+cast(Chan geRequest.ChangeRequest_ID
as nvarchar) +CHAR(34)+'>Open</a></center>',"

I want to invoke a Client side javascript function and pass the value
of the ID. How can I accomplish this such when a user clicks "Open" he
goes to a new window with the same ID.

I tried this but it does not work:
On Server side:
sSql = "SELECT DISTINCT " + "'Action' = '<center><a href= 'javascript:
NewWindow('+cast(ChangeRequest.ChangeRequest_ID as nvarchar)+
CHAR(34)+)'>Open</a></center>',"

On Client side:
function NewWindow(myID)
{
window.open("ChangeRequest.aspx?ID="+myID,"WindowName","width=500,height=600");
}
</script>

View 1 Replies View Related

If Statement Returning False On A True Statement?

Apr 4, 2011

my webstie allows users to change the color of the background, so to keep the text readable I have it changing as well.the color picker I am using has text boxes with rgb values 0-255 for each.I am trying to get one bit of text to alternate between red and blue with the conditions

Code:
if(blue>green && blue>red)
{

[code]....

View 2 Replies View Related

Search Inside Xml With Javascript (FF And IE)

Dec 28, 2006

A webpage recieves XML from the server using xmlhttp.
What I want to do is search in this xml browser-side.

XML-example:

<company>
<equipment>
<trackno>1</trackno>
<icode>ruthd</icode>
</equipment>
<equipment>
<trackno>4</trackno>
<icode>rdke</icode>
</equipment>
</company>

I want to display the icode from equipment with trackno 4.

Serverside I would have done that using XPath :
SelectSingleNode("/company/equipment [trackno=&#394;']/icode")

How do I do this in Browserside Javascript.
The code has to work in both FireFox and IE.

View 2 Replies View Related

Php Inside Javascript And Viceversa

Nov 25, 2005

How to call to a function in javascript sending a numerical parameter? This parameter will be used in php code inside javascript:

call the javascript function:
<A href='javascript:void(0)' onClick='ShowFAQ(25)'>text</A>

<script type="text/javascript">
function ShowFAQ(faqid){
window.document.labeltitlefaq.innerText='<?php echo($arrayFAQtitle[faqid])?>' ;
}
</script>

The previous code does not work, and if I replace "faqid" to a number, it works fine.

View 4 Replies View Related

HTTP Post Inside JavaScript

Jul 20, 2005

Is it possble to do a HTTP post request inside JavaScript? - That is I don't
want to use a HTML FORM, but need a JavaScript to post a value to a PHP script not encoding the parameters in a URL.

View 1 Replies View Related

Saving Into A Php Variable Inside Javascript Code

Feb 23, 2006

I have the following code inside the <head> of my php file. What this code will do is change the style="display:none;" of a div element, depending on which option is selected within a combo box. Code:

View 1 Replies View Related

Javascript Inside Of Ajax Created Page....

Oct 13, 2007

I've run into this a few times and have never found a way to deal it. Basically I'm building a user administration cms using mostly ajax calls to admin modules. It works great but I'm running into a huge problem that I need to figure out how to fix, (if possible).

As the title says the issue is including and executing javascript code inside a page that gets called via ajax. One specific example of the problem I'm having is creating sortable lists with scriptalacous. It works great if I access the page directly, but if I access the page using an ajax call the javascript of the page doesn't seem to fire.

View 9 Replies View Related

Javascript Inside Javascript

Dec 12, 2005

Basically, on one of my sites I'm running adsense and today I added Chitika. The problem is, I can't run those type of ads through my banner advertising program.

The banner advertising program calls the banners/HTML from code like this:

<script language=JavaScript src=http://www.mysite.com/advertise/abm.asp?z=1></script>

And using that program I'm able to either choose a banner or HTML I want to display when that code above is used. It displays HTML ok... but when I try to run an ad of either adsense or chitika nothing displays on the page. The code that would be called is:

<script type="text/javascript"><!--
*Chicika code in here*
//--></script>
<script src="http://xxx/xxx/mm.js" type="text/javascript">
</script>

So... it looks like I can't have javascript call another javascript to display on a page. My question is then... how can I edit the above to make it work or how can I work around this problem? I'd really want this to work with Chitika and not so much with adsense... but it appears both Chitika and Adsense use similar javascript code.

View 9 Replies View Related

Place A Javascript Menu Inside A Cell Of A Table.

Jul 23, 2005

I´m trying to place a javascript navigation menu inside a cell of
a table in my page, the problem is that the constructor of the menu
object has parameters for menu positioning and size and when the
window is rezised the menu stands at the same position and with the
same size.

My question is: is there a way to modify those parameters
dinamically to match window size, and how is that made, or is there
another way to include that menu using a table for page layout.

View 4 Replies View Related

Call Parent Javascript Function From Inside An Iframe?

Apr 5, 2006

The challenge is as above really. I have a page with an iframe in it, and need to call a JS function in the *parent* page, *from* inside the iframe.

(It's for Google Maps, but I won't bore you with the complexities of that, as it doesn't affect the question).....

View 18 Replies View Related

JQuery :: DatePicker Inside An ASP.Net DetailsView Control Inside An AJAX UpdatePanel In VB?

Nov 6, 2010

I've been searching for about 3 days on this topic. I'm trying to get a template field inside of an ASP.Net detailsview control inside of an ajax updatepanel to work with the jquery datepicker. Very frustrating! I'm using VB with VS 2010. I can get the datepicker to work fine with a simple text box inside of an update panel but when I put it inside of a detailsview control it stops working.

View 4 Replies View Related

Variable Declaration Inside Eval Inside With

Apr 11, 2007

consider the next code:

var obj = {};
with(obj) {
var x = 10;
}
print(x);
print(obj.x);

It prints 10 and undefined. Here, one could expect that obj.x get the
value 10. But it's not the case, because variable declarations are
placed at the start of function code (or global code), so the
previous code is equivalent with:

var obj;
var x;
obj = {};
with(obj) {
x = 10;
}
print(x);
print(obj.x);

You can clearly see now that x is placed in the outer context. But
consider the next:

var obj = {};
with(obj) {
eval("var x = 10;");
}
print(x);
print(obj.x);

I was expecting that obj.x would get the value 10 here. But no, it
gives the same output as the previous code. I tested it with
spidermonkey, kjs and ie jscript. Looking at the ECMA spec, I could
not find anything that describes that behaviour. Code:

View 3 Replies View Related







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