Click here to Skip to main content
15,886,258 members
Home / Discussions / JavaScript
   

JavaScript

 
QuestionAccess Device API using Javascript Pin
Gouranga Das21-Aug-14 8:00
Gouranga Das21-Aug-14 8:00 
AnswerRe: Access Device API using Javascript Pin
Richard MacCutchan21-Aug-14 21:59
mveRichard MacCutchan21-Aug-14 21:59 
AnswerRe: Access Device API using Javascript Pin
Dennis E White22-Aug-14 4:47
professionalDennis E White22-Aug-14 4:47 
AnswerRe: Access Device API using Javascript Pin
Dennis E White22-Aug-14 5:14
professionalDennis E White22-Aug-14 5:14 
QuestionAccess Device API using Javascript Pin
Gouranga Das21-Aug-14 7:59
Gouranga Das21-Aug-14 7:59 
AnswerRe: Access Device API using Javascript Pin
ZurdoDev22-Aug-14 9:16
professionalZurdoDev22-Aug-14 9:16 
Questionscrape a table from web Pin
Mahmoud198716-Aug-14 2:58
Mahmoud198716-Aug-14 2:58 
AnswerRe: scrape a table from web Pin
borchef28-Aug-14 21:08
borchef28-Aug-14 21:08 
You can try using AJAX.

Create an ajax call to a php file with the following code:

getPage.php

<?php

function getPost( $name, $default ){
    $value = $default;
    if( isset( $_POST[ $name ] ) && $_POST[ $name ] != '' ) {
        $value = $_POST[ $name ];
    } 
    return $value;    
}

function getSslPage($url) {
    $ch = curl_init();
    curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, FALSE);
    curl_setopt($ch, CURLOPT_HEADER, false);
    curl_setopt($ch, CURLOPT_FOLLOWLOCATION, true);
    curl_setopt($ch, CURLOPT_URL, $url);
    curl_setopt($ch, CURLOPT_REFERER, $url);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, TRUE);
    $result = curl_exec($ch);
    curl_close($ch);
    return $result;
}

$site = getPost( 'site', '' );
//$site = 'http://www.example.com/';
$content = 'empty';
$error = '';
$content = getSslPage( $site );
if( !$content ) {
   $error = 'no file found';
}

$arr = array( 'error' => $error, 'htmlResult' => htmlspecialchars($content)  );
echo json_encode($arr);
?>


in javascript:
var data = {};
data["site"]  = 'http://www.example.com/';
$.ajax({
    type: "POST",
    url: 'getPage.php',
    data: data,
    dataType: 'json',
    success: function( msg )
    {
        if( msg['error'] !== '' ) {
            alert( 'there was an error: '  + msg['error'] );
        }
        else {
            alert( ' html Found: ' +  msg['htmlResult'] );
        }
    }
});

QuestionHow to validate postdate? Pin
loga_mca13-Aug-14 21:14
professionalloga_mca13-Aug-14 21:14 
SuggestionRe: How to validate postdate? Pin
Kornfeld Eliyahu Peter13-Aug-14 23:17
professionalKornfeld Eliyahu Peter13-Aug-14 23:17 
AnswerRe: How to validate postdate? Pin
Tushar Guru8-Sep-14 21:57
Tushar Guru8-Sep-14 21:57 
AnswerRe: How to validate postdate? Pin
Sibeesh KV24-Sep-14 0:56
professionalSibeesh KV24-Sep-14 0:56 
QuestionCollapsible gridview using javascript Pin
Member 1097302613-Aug-14 9:35
Member 1097302613-Aug-14 9:35 
AnswerRe: Collapsible gridview using javascript Pin
Anurag Gandhi22-Aug-14 8:56
professionalAnurag Gandhi22-Aug-14 8:56 
QuestionForum software.. Pin
Fever42012-Aug-14 5:50
Fever42012-Aug-14 5:50 
SuggestionRe: Forum software.. Pin
Richard Deeming12-Aug-14 8:55
mveRichard Deeming12-Aug-14 8:55 
QuestionRequireJS in ASP.Net Webforms Pin
Member 102920078-Aug-14 5:00
Member 102920078-Aug-14 5:00 
Questionany body convert this code( vb script) to java script Pin
boopathiraj4-Aug-14 22:22
boopathiraj4-Aug-14 22:22 
QuestionCondition Always true when checking for "undefined" in Javascript Pin
Vimalsoft(Pty) Ltd3-Aug-14 9:28
professionalVimalsoft(Pty) Ltd3-Aug-14 9:28 
AnswerRe: Condition Always true when checking for "undefined" in Javascript Pin
Blikkies3-Aug-14 22:48
professionalBlikkies3-Aug-14 22:48 
AnswerRe: Condition Always true when checking for "undefined" in Javascript Pin
Kornfeld Eliyahu Peter4-Aug-14 0:19
professionalKornfeld Eliyahu Peter4-Aug-14 0:19 
AnswerRe: Condition Always true when checking for "undefined" in Javascript Pin
Kornfeld Eliyahu Peter3-Aug-14 22:55
professionalKornfeld Eliyahu Peter3-Aug-14 22:55 
AnswerRe: Condition Always true when checking for "undefined" in Javascript Pin
Graham Breach3-Aug-14 22:56
Graham Breach3-Aug-14 22:56 
AnswerRe: Condition Always true when checking for "undefined" in Javascript Pin
Kornfeld Eliyahu Peter4-Aug-14 0:15
professionalKornfeld Eliyahu Peter4-Aug-14 0:15 
GeneralRe: Condition Always true when checking for "undefined" in Javascript Pin
Vimalsoft(Pty) Ltd4-Aug-14 5:39
professionalVimalsoft(Pty) Ltd4-Aug-14 5:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.