is it possible to do it in jQuery AJAX
I have this div with the align center left or right
codes
<div class="dropdown" id="dropdown_one">
<h3>Position of logo on the document</h3>
<input type="hidden" name="c" value="cprof" />
<input type="hidden" name="user_code" value="<?=$_GET['ucom'];?>" />
<input type="hidden" name="com_code" value="<?=$_GET['ccom'];?>" />
<?
$get_position = SET_SQL( "SELECT * FROM jon_com_add WHERE user_code = '".$_GET['ucom']."' " );
?>
<input type="hidden" name="position_id" value="<?=$get_position['a_id'];?>" />
<input type="hidden" name="position_change" value="chg" />
<label>Logo Position : </label>
<p>
<input name="logo_position" type="radio" value="left">
Left
<input name="logo_position" type="radio" value="center">
Center
<input name="logo_position" type="radio" value="right">
Right
</p>
<label>Logo Width</label>
<input type="text" name="logo_width" value="632 x 128">
<p>Format logo: <span id="logo_size">632 × 128</span></p>
</div><!-- .dropdown_menu -->
<div class="company_name" align="<?=$set_position['add_position'];?>">
<strong><?=$set['com_name'];?></strong><br />
<?=$set['address'];?>
</div>
it was connected to the database.
now my jQuery
$(function(){
$('input[name=logo_position]').click(function(e) {
$('<img src="images/ajaxLoader.gif" id="loading" style="width:auto;" />').appendTo(".company_name");
//Cancel the link behavior
e.preventDefault();
//Get the A tag
var uc = $( 'input[name=usercode]' ).val();
var cc = $( 'input[name=com_code]' ).val();
var l_p = $( 'input[name=logo_position]' ).val();
var aid = $( 'input[name=position_id]' ).val();
var p_chg = $( 'input[name=position_change]' ).val();
alert(aid);
$.ajax({
type:"GET",
url:"forms/tem.php",
data: {ucode: uc, ccode: cc, logo_p: l_p, a_id: aid, chg: p_chg},
dataType: 'html',
target: '.company_name',
success: function(data){
$(".company_name").find('img#loading').remove();
$(".company_name").html(data);
}
})
});
});
What im trying to do here is that when i click the radio button of logo_position
on the div class="company_name" align="left" will change. for example i click center it should be on the center.
is my jQuery Ajax wrong?
It doesn’t save on the database the only it save was left the first radio button. but when i click center the ajax will just read was just left.
Something like i was doing a live view. So when i change something it will also change the position the font and other thing when i just click…
is this possible to do on jquery?
try this for alignment of div based onclick of radio buttons:
DEMO