Avatar billede stairway_to_heaven Nybegynder
02. april 2009 - 14:33 Der er 3 kommentarer

Javascript med Php

Jeg har en fil hvori der et javascript flg:
<script language="javascript">
function loadContent(){
document.forms[0].payment_extrainfo.value = content;
}
</script>
<script type="text/javascript" src="content.js"></script>

Den henter indholdet fra content.js = var content = ''
Men det den henter kan ikke være php fx: (bare et udsnit):
$subject                 = subjecttxt.":".$db->f("order_id");                       
// Your unique order ID.

$customerOrderId         = $db->f("order_id");                                       
// Transaction currency. Currently "DKK" is only accepted.

$currency                 = $_SESSION['vendor_currency'];                               
// Link to your product. Visible for the customer.

$itemURL                 = "http://127.0.0.1/jom/index.php?option=com_virtuemart";   
// Transaction amount in danish "Øre". Ex. DKK 20,00 is written as "2000".
$amount                    = $db->f("order_total") *100;
$annonymousPayerAllowed = annonymousPayerAllowed;
$expireDays             = expireDays;

$EWIRE_VERIFIED_STATUS     = EWIRE_VERIFIED_STATUS;
$EWIRE_INVALID_STATUS     = EWIRE_INVALID_STATUS;

$EWIRE_ACCEPT             = EWIRE_ACCEPT;
$EWIRE_DECLINE             = EWIRE_DECLINE;

Den skal hente det og updatere et textarea med det, nogen der kan hjælpe?
Avatar billede olebole Juniormester
02. april 2009 - 15:06 #1
<ole>

Din js-fil kan sagtens være en dynamisk fil, skrevet i PHP:
    <script type="text/javascript" src="content.php"></script>

- men så kan du vel ligeså godt lade PHP skrive direkte i textarea'et

/mvh
</bole>
Avatar billede stairway_to_heaven Nybegynder
02. april 2009 - 15:23 #2
Jeg skal bare have et textarea, allerede eksisterende der automatisk bliver udfyldt med flg:
<?php

/* ewirePayment class. Contains support functions for handling payments through ewire */

class ewirePayment {
    public $companyId;
    public $companyPrivateKey;
    public $ewirePaymentBaseURL;
    public $ewirePaymentChangeBaseURL;

   
function __construct() {
        // Do not change theese
        $this->ewirePaymentBaseURL = "https://secure.ewire.dk/payment/transaction.ew";       
        $this->ewirePaymentChangeBaseURL = "https://secure.ewire.dk/payment/transaction_change.ew";
    }

}
// Create instance of ewire class
$EWIRE = new ewirePayment();

// Sets values for form no change needed all is done by Virtuemart<br />
// These values can be defined from admin
// Subject on the payment. Visible for the customer. Do not use "ÆØÅ" letters here.

$subject                 = subjecttxt.":".$db->f("order_id");                       
// Your unique order ID.

$customerOrderId         = $db->f("order_id");                                       
// Transaction currency. Currently "DKK" is only accepted.

$currency                 = $_SESSION['vendor_currency'];                               
// Link to your product. Visible for the customer.

$itemURL                 = "http://127.0.0.1/jom/index.php?option=com_virtuemart";   
// Transaction amount in danish "Øre". Ex. DKK 20,00 is written as "2000".
$amount                    = $db->f("order_total") *100;
$annonymousPayerAllowed = annonymousPayerAllowed;
$expireDays             = expireDays;

$EWIRE_VERIFIED_STATUS     = EWIRE_VERIFIED_STATUS;
$EWIRE_INVALID_STATUS     = EWIRE_INVALID_STATUS;

$EWIRE_ACCEPT             = EWIRE_ACCEPT;
$EWIRE_DECLINE             = EWIRE_DECLINE;

$companyPrivateKey         = companyPrivateKey;
$companyId                 = companyId;

$paymentAMD             = md5(EWIRE_VERIFIED_STATUS . EWIRE_ACCEPT);
$paymentDMD             = md5(EWIRE_INVALID_STATUS . EWIRE_DECLINE);

$acceptURL                 = $mosConfig_live_site."/index.php?option=com_virtuemart&page=checkout.ewire&statusMd=".$paymentAMD."&order_id=".$customerOrderId;
$declineURL             = $mosConfig_live_site."/index.php?option=com_virtuemart&page=checkout.ewire&statusMd=".$paymentDMD."&order_id=".$customerOrderId;       
//$declineURL                 = "netpayment.php";

// Calculates MD5 value of all values
$validateMD = md5($companyPrivateKey . $companyId . $subject . $customerOrderId . $amount . $currency . $expireDays . $annonymousPayerAllowed . $acceptURL . $declineURL);
?>

<h1>Ewire</h1>
<form action="<? echo $EWIRE->ewirePaymentBaseURL ?>" target="_blank" method="post">
  <input type="hidden" name="companyId" value="<? echo companyId ?>" />
  <input type="hidden" name="lang" value="<? echo lang ?>" />
  <input type="hidden" name="subject" value="<? echo $subject ?>" />
  <input type="hidden" name="customerOrderId" value="<? echo $customerOrderId ?>" />
  <input type="hidden" name="amount" value="<? echo $amount ?>" />
  <input type="hidden" name="currency" value="<? echo $currency ?>" />
  <input type="hidden" name="itemURL" value="<? echo $itemURL ?>" />
  <input type="hidden" name="expireDays" value="<? echo expireDays ?>" />
  <input type="hidden" name="annonymousPayerAllowed" value="<? echo annonymousPayerAllowed ?>" />
  <input type="hidden" name="acceptURL" value="<? echo $acceptURL ?>" />
  <input type="hidden" name="declineURL" value="<? echo $declineURL ?>" />
  <input type="hidden" name="validateMD" value="<? echo $validateMD ?>" />
  <input type="image" title="Start betaling" src="<? echo $mosConfig_live_site ?>/components/com_virtuemart/shop_image/ps_image/ewire_images/ewire_btn.gif" value="Start betaling" />
</form>
Avatar billede olebole Juniormester
02. april 2009 - 15:48 #3
Jeg forstår ikke dit spørgsmål
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Vi tilbyder markedets bedste kurser inden for webudvikling

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester