View difference between Paste ID: CSha0xTk and q0Z8tG6Y
SHOW: | | - or go back to the newest paste.
1
<!-- Include AJAX Toolkit 29.0 -->
2
<script src="/soap/ajax/29.0/connection.js"></script>
3-
3+
 
4
<!-- Set the Ajax client's session ID -->
5
<script type="text/javascript">
6-
6+
 
7-
    // Get the session ID from the "sid" cookie
7+
    /* Get the session ID from the "sid" cookie */
8-
8+
 
9
    var sidRegExp = /sid=([^;]+);/;
10
    var sidMatches = sidRegExp.exec(document.cookie);
11
    var sid = sidMatches[1];
12-
12+
 
13-
    // Set the session ID for the Ajax client
13+
    /* Set the session ID for the Ajax client */
14-
14+
 
15
    sforce.connection.sessionId = sid;
16
</script>
17-
17+
 
18
<!-- Retrieve and display the organization to confirm success -->
19
<span id="ajaxOrgName"></span>
20
<script type="text/javascript">
21
    var results = sforce.connection.query("SELECT Name FROM Organization");
22-
    var orgName = results.records.Name;  // Valid only when 1 record in results
22+
    var orgName = results.records.Name;  /* Valid only when 1 record in results */
23
    document.getElementById("ajaxOrgName").innerHTML = orgName;
24
</script>