aqui muestro el codigo este es el view en codeigniter
Código PHP:
<?php echo link_tag('public/css/home.css'); ?>
<?php echo link_js('public/javascript/jquery-muro.js'); ?>
<div class="span9">
<div class="notice-home">
<a href="" class="avatar" style="z-index: 100"><img src="48_1128336.jpg"></a>
<div class="shout-textarea">
<textarea class="span7" id="opina" name="opina" placeholder="Escribe algo"></textarea>
</div>
<div class="content-notice">
<div class="span6">
<div id="attaContent">
<div id="fotoMuro" style="display: none;">
<input type="file" class="span3" name="foto" id="foto">
</div>
<div id="videoMuro" style="display: none;">
<input type="text" id="video" name="video">
</div>
<div id="linkMuro" style="display: none;">
<input type="text" id="link" name="link">
</div>
</div>
</div>
<div class="footer-notice clearfix">
<input onclick="muro.agregar()" type="submit" class="floatR btn" value="agregar">
<ul class="options-notice">
<li class="btn">
<a href="#" onclick="muro.loading('foto', this);"><div class="btn-text"><i class="n-pic"></i></div></a>
</li>
<li class="btn">
<a href="#" onclick="muro.loading('video', this);"><div class="btn-text"><i class="n-vid"></i></div></a>
</li>
<li class="btn">
<a href="#" onclick="muro.loading('link', this);"><div class="btn-text"><i class="n-link"></i></div></a>
</li>
</ul>
</div>
</div>
</div>
</div>
Código:
me envie la variable muro.type el cual me lo envie type POTS me la envia pero me da este error [object Object]<input onclick="muro.agregar()" type="submit" class="floatR btn" value="agregar">
Código Javascript:
Ver original
var muro = { type: '', loading: function(aid, obj) { muro.type = aid; $('#' + aid + 'Muro').show(function(){ $('#attaContent > div').hide(); $('#' + aid + 'Muro').show(); $('.span6').addClass('shout-notice'); }); $(obj).parent().show(); // return false; }, agregar: function() { muro.loading(true); var inpt = $('input[name=' + muro.type + ']'); var el = new Array(), params = ''; el['textarea'] = $('#opina'); el['video'] = $('#video'); el['picture'] = $('#foto'); el['link'] = $('#link'); if(empty($(el['textarea']).val())){ $(el['textarea']).focus(); return; } if($(el['picture']).val() != '' && $(el['textarea']).val() != ''){ muro.picture_Step1(); return; } params = 'opina=' + encodeURIComponent($(el['textarea']).val()) + '&video=' + encodeURIComponent($(el['video']).val())+ '&link=' + encodeURIComponent($(el['link']).val())+ '&type=' + encodeURIComponent(inpt); $.ajax({ type: 'POST', url: global_data.url + '', data: params, success: function(h){ switch(h.charAt(0)){ case '0': break; case '1': break; } }, error: function(){ } }); }, }