Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8836309
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 14, 20262026-06-14T09:28:00+00:00 2026-06-14T09:28:00+00:00

I have the following button: <?php $this->widget(‘bootstrap.widgets.TbButton’, array( ‘label’=>’myLabel’, ‘buttonType’=>’ajaxButton’, ‘url’=>’someUrl’, ‘type’=>’primary’, // null,

  • 0

I have the following button:

<?php $this->widget('bootstrap.widgets.TbButton', array(
  'label'=>'myLabel',
  'buttonType'=>'ajaxButton', 
  'url'=>'someUrl', 
  'type'=>'primary', // null, 'primary', 'info', 'success', 'warning', 'danger' or 'inverse'
  'size'=>'small', // null, 'large', 'small' or 'mini'
  'ajaxOptions'=>array(
      'type' => 'POST',
      'beforeSend' => '
        function( request ) {
          //alert(request);
        }'
      ,
      'success' => 'function( data ) {
          //alert(data);
        }'
      ,
      'data' => array( 
        'actionName' => "INCREMENT"
      )
  ),
)); ?>

So, the tricky part is, how do I connect this button to actual backend code? I would assume it’s done by posting to a URL. In my case I’ve got a URL set as:

'url'=>'someUrl'

Does this mean I must create a view, controller and model so there is a URL to post to? isn’t there an easier way without going through that effort?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-14T09:28:01+00:00Added an answer on June 14, 2026 at 9:28 am

    You do not necessarily need a new view. But you will need an action that catches this request.

    In Yii each action has a unique url that refers to it, and there are functions that generate such a url for us, namely createUrl. There are other versions of createUrl also, the one here is from CController.

    So you’d modify your url property as:

    'url'=>$this->createUrl('controller-name/action-name')
    

    Then in your controller add the action:

    public function actionActionname(){
        // do your server-side stuff
        // maybe also return some message back to client-side view
        if(success)
            echo "Y";
        else echo "N";
        Yii::app()->end();
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have the following code: <?php $this->beginWidget('zii.widgets.jui.CJuiDialog', array( 'id'=>'mydialog', // additional javascript options for
I have following buttons in my table <td><Button id=approval_<?php echo $i; ?> type=submit class=myclass
I have following code: $boxId = 1; $explainationBox='<input type=button id=<?php echo $boxId; ?> value=send
I have the following code: <?php if (!$user) { ?> <div class=fb-login-button data-perms=email,user_birthday,publish_stream>Login with
I have the following jQuery/ajax script: jQuery(input.button).click(function(){ jQuery.ajax({ url: 'addfav.php', type: 'POST', data: {'id':jQuery(this).closest(div).attr(id),is_ajax:
I have the following jQuery code: $('.button').click(function(e) { e.preventDefault(); var id = $(this).attr('id'); var
I have the following button: <input type=button count='<?php echo count($_SESSION['children']);?>' name=children class=add_child value=Add Another
I have the following PHP code that checks which choice from a radio button
I have the following simple object embed for Flash: <object id=siwp_obj type=application/x-shockwave-flash data=button.swf?file=%2F/ex.php?id=89804c7326e92a00c5c88c181190af8159cf060b height=32
I have the following button: <Club:RolloverButton runat=server ValidationGroup=Login1 Text=Login ID=LoginButton CommandName=Login CssClass=links /> .links

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.