EasyUI Forum

General Category => EasyUI for jQuery => Topic started by: pedroc on September 22, 2015, 09:40:47 AM



Title: i lost the style when send html code by json
Post by: pedroc on September 22, 2015, 09:40:47 AM
hi, i have the next problem. When i send the htlm code through the json i lost the style. here show me code:

function submitForm() {
    if($('#user').val() != '' && $('#pass').val() != '') {
        $.ajax({
            type: "POST",
            url: "index.php/maincontroller/sing_in",
            dataType: "json",                       
            data: {user:$('#user').val(),pass:calcMD5($('#pass').val())},
            cache: false,
            success: function(data){
                if(dato.success == 'true') {
                    $("#dlogin").html('');          
                    $("#welcome").html("<a class='easyui-linkbutton'>Add</a>");   //this is problem    
                }
                ...

<div class="easyui-layout" style="width:100%;height:100%;">
    <div data-options="region:'north'" style="height:150px">
        <div style="position:relative"><img src=<?php echo base_url("img/header/header.png"); ?>>
            <div style="position:absolute; top:10; left:500;"><img src=<?php echo base_url("img/header/logo.png"); ?>></div>
            <div id="dlogin" style="position:absolute; top:110; left:1200;"><?php if(isset($login)) echo $login; ?></div>
            <div id="welcome" style="position:absolute; top:5%; left:80%;">
                   <!--should be shown here div whit style, but loses-->
            </div>
        </div>
    </div>

HELP ME PLEASE I NEED SOLVE THIS PROBLEM FAST


Title: Re: i lost the style when send html code by json
Post by: stworthy on September 22, 2015, 06:42:04 PM
Please try this:
Code:
$("#welcome").html("<a class='easyui-linkbutton'>Add</a>");
$.parser.parse('#welcome');