小编pey*_*y22的帖子

检查是否加载了jQuery和jQuery UI

您好我需要使用JavaScript和php构建第三方小部件.这个小部件需要在jQuery和jQuery UI中使用,也可能在未来的其他jQuery库和插件中使用.所以,当我的客户端将这个Widget放到他的网站时,我需要知道jQuery和jQuery UI是否已经加载,如果没有加载我自己.我建了一些但不起作用.

    <script>
if (typeof jQuery == 'undefined') {  
    // jQuery is not loaded  
    //alert('jQuery is not loaded');
    var script = document.createElement('script');
    script.type = "text/javascript";
    script.src = "http://code.jquery.com/jquery-1.9.1.js";
    document.getElementsByTagName('head')[0].appendChild(script);

    var script_ui = document.createElement('script');
    script_ui.type = "text/javascript";
    script_ui.src = "http://code.jquery.com/ui/1.10.3/jquery-ui.js";
    document.getElementsByTagName('head')[0].appendChild(script_ui);

} else {
    // jQuery is loaded
    //alert('jQuery is loaded');
    if (typeof jQuery.ui !== 'undefined') {
        // ui plugin exists
        alert('ui plugin exists');
    } else {
        // ui plugin DOES NOT exist
        //alert('ui plugin DOES NOT exist');
        var script_ui …
Run Code Online (Sandbox Code Playgroud)

jquery jquery-ui undefined loaded

2
推荐指数
1
解决办法
6686
查看次数

使用PHP连接到示例SOAP 1.1

您好我需要在php中使用密码,用户名和SourceId连接到SOAP Web服务.SOAP请求是:

POST /webservices/AgentOnlineReservation.asmx HTTP/1.1
Host: 54.228.189.53
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://tempuri.org/GetHotelsData"

<?xml version="1.0" encoding="utf-8"?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <GetHotelsData xmlns="http://tempuri.org/">
      <SourceId>string</SourceId>
      <UserName>string</UserName>
      <Password>string</Password>
    </GetHotelsData>
  </soap:Body>
</soap:Envelope> 
Run Code Online (Sandbox Code Playgroud)

请帮我.

php soap web-services

1
推荐指数
1
解决办法
1万
查看次数

如何将xml字符串格式转换为php数组

您好,我有 php var(字符串)看起来像 xml:它不是真正的 xml 文件,只是具有与 xml 相同结构的 php 字符串。我需要在 php 循环中从中获取 ROW_DATA 字段。(这个 xml 结构我从soap web 服务中得到)。

2013/7/9 10:01:29 上午 7/9/2013 10:01:29

<ROW_DATA>
    <AMOUNT_ROOMS>2</AMOUNT_ROOMS>
    <SUPP_MOVIE_NAME>tiz</SUPP_MOVIE_NAME>
    <AMOUNT_NIS>3680</AMOUNT_NIS>
    <PRICE_DOCKET_ID>1233</PRICE_DOCKET_ID>
</ROW_DATA>

<ROW_DATA>
    <AMOUNT_ROOMS>1</AMOUNT_ROOMS>
    <SUPP_MOVIE_NAME>mantiz</SUPP_MOVIE_NAME>
    <AMOUNT_NIS>3690</AMOUNT_NIS>
    <PRICE_DOCKET_ID>1234</PRICE_DOCKET_ID>
</ROW_DATA>

<StartTime>7/9/2013
    10:01:29
    AM</StartTime>
<EndTime>7/9/2013
    10:01:30
    AM</EndTime>
Run Code Online (Sandbox Code Playgroud)

现在我需要在 php 数组中获取它...有什么想法吗???

php xml arrays

1
推荐指数
1
解决办法
2万
查看次数

使用$ .ajax传递变量

我有两个复选框,其中包含一些像这样的值:

<label for="hotel_boutique"><input id="hotel_boutique" name="hotel_boutique" value="test" type=checkbox />test</label><br />
Run Code Online (Sandbox Code Playgroud)

3

我用这样的Ajax调用得到这些值:

<script>
jQuery("input[type='checkbox']").change(function(){

if (jQuery('input#hotel_boutique').is(':checked')) {
    var hotel_boutique = jQuery("#hotel_boutique").map(function () {return this.value;}).get();
}else{
    var hotel_boutique = 'NULL';
    }
if (jQuery('input#hotel_stars').is(':checked')) {
    var hotel_stars = jQuery("#hotel_stars").map(function () {return this.value;}).get();
}else{
    var hotel_stars = 'NULL';
    }

var data = 'hotel_boutique="'+hotel_boutique+'"&hotel_stars="'+hotel_stars+'"';
jQuery.ajax({
    url: "processAjax.php",
    type: "GET",
    data: data,
    cache: false,
    beforeSend: function() {
        jQuery("#loading").show();
    },
    success: function(data, textStatus, XMLHttpRequest){
        jQuery("#content").html('');
        jQuery("#content").append(data);
        jQuery("#loading").hide();
    },
    error: function(MLHttpRequest, textStatus, errorThrown){
        alert(errorThrown);
    }

});
});
</script> …
Run Code Online (Sandbox Code Playgroud)

php variables ajax jquery parameter-passing

0
推荐指数
1
解决办法
80
查看次数